mwisselaar commented on issue #248: URL: https://github.com/apache/polaris-tools/issues/248#issuecomment-4881325741
## Related issue: CORS blocks requests in local Docker setup When running the console and Polaris on different ports (e.g. console on `8080`, Polaris on `8181`), the browser blocks all API requests due to CORS: ``` Access to XMLHttpRequest at 'http://host:8181/api/catalog/v1/oauth/tokens' from origin 'http://host:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. ``` Different ports on the same host are treated as different origins by the browser. ## Workaround A reverse proxy is needed to serve both the console and the Polaris API from the same origin: ```nginx server { listen 9090; location /api/ { proxy_pass http://127.0.0.1:8181; } location / { proxy_pass http://127.0.0.1:8080; } } ``` Then run the console pointing to the proxy: ```bash docker run -p 8080:8080 \ -e VITE_POLARIS_API_URL=http://host:9090 \ -e VITE_OAUTH_TOKEN_URL=http://host:9090/api/catalog/v1/oauth/tokens \ apache/polaris-console:latest ``` ## Suggested fix The README should document this requirement for local Docker setups. Alternatively, a `docker-compose.yml` with an nginx sidecar would make this work out of the box. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
