[ 
https://issues.apache.org/jira/browse/ASTERIXDB-3505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Suryaa Charan resolved ASTERIXDB-3505.
--------------------------------------
    Resolution: Invalid

The CORS issue in the browser was encountered during an attempt to access an 
API hosted on a remote server via port forwarding. The client was running on 
port 19006, while the server was running on port 19002. Initially, only the 
client (port 19006) was port-forwarded, leading to a CORS failure.



Upon investigation, it was determined that the browser was sending a preflight 
{{OPTIONS}} request to verify CORS-related permissions before making the actual 
request. The {{OPTIONS}} request was failing because the server running on port 
19002 was not accessible via the localhost, as it had not been port-forwarded. 
Therefore, the CORS preflight request was unable to retrieve the necessary 
headers from the server, resulting in a CORS failure.

To resolve the issue, port forwarding was set up for both the client (port 
19006) and the server (port 19002). Once both were properly port-forwarded, the 
{{OPTIONS}} request succeeded, allowing the CORS check to pass. The behavior of 
the {{OPTIONS}} request is consistent with a preflight request, which is used 
by browsers to obtain CORS-related headers and verify that the server allows 
cross-origin requests.

{*}Conclusion{*}:

The CORS issue has been resolved by enabling port forwarding for both the 
client and the server. The {{OPTIONS}} preflight request is a standard 
mechanism used by browsers to determine if cross-origin requests are permitted, 
and it required access to the server on port 19002 to retrieve the necessary 
CORS headers.
h3.  

> CORS Issue on New UI (Port 19007) Preventing API Access via Port Forwarding
> ---------------------------------------------------------------------------
>
>                 Key: ASTERIXDB-3505
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-3505
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: UI - Web Interface
>            Reporter: Suryaa Charan
>            Priority: Major
>              Labels: triaged
>
> CORS issue while trying to use the new user interface running on port 19007. 
> When attempting to interface with the backend API via port forwarding, the UI 
> fails due to CORS restrictions. This issue is not present in the older UI, 
> where CORS is properly handled, allowing seamless communication with the 
> backend. This issue occurs when the server is remote and we connect to the UI 
> with port-forwarding.
> Expected Behavior:
> The new UI should interface with the backend API without CORS issues, similar 
> to the older UI.
> Actual Behavior:
> The new UI is blocked by CORS when attempting to communicate with the backend 
> API, preventing functionality.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to