Configuration-dependant CORS errors when running ng serve #2052
Unanswered
AlexGuironnetRTE
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm opening this discussion because I'm having issues with CORS when trying to use the app with ng serve. I can't pinpoint the exact date but it must be fairly recent as I remember working with ng serve quite a bit when I was setting up the Cypress tests (and even more recently with @olivierPigeon-RTE).
As @freddidierRTE doesn't have the same results, it might be configuration-dependant, so here is mine:
Configuration
Test process
Chrome without security =
google-chrome --disable-web-security --user-data-dir=~/chromeTemp
See https://alfilatov.com/posts/run-chrome-without-cors/
@freddidierRTE do you have the same behaviour ? If so it looks like the problem is with the docker mode only.
Details on error:
Firefox
OPTIONS http://localhost:2002/config/web-ui.json -> CORS Missing Allow Origin (405)
GET -> NS_ERROR_DOM_BAD_URI
Chrome message:
Access to XMLHttpRequest at 'http://localhost:2002/config/web-ui.json' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
curl 'http://localhost:2002/config/web-ui.json' -X OPTIONS -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0' -H 'Accept: /' -H 'Accept-Language: en-GB,en;q=0.5' --compressed -H 'Access-Control-Request-Method: GET' -H 'Access-Control-Request-Headers: authorization' -H 'Referer: http://localhost:4200/' -H 'Origin: http://localhost:4200' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache'
Beta Was this translation helpful? Give feedback.
All reactions