Access-Control-Allow-Origin fails when docker container sends "*" as Header Value
See original GitHub issueThe play-with-docker containers will override the value with the container’s URL. If the project inside the container returns “*”, it will fail in Chrome and Firefox, because sending the header two times with different values is not allowed as per specification.
Example error in Chrome:
XMLHttpRequest cannot load http://pwd10_0_9_3-8080.play-with-docker.com:4848/api/project/index. The 'Access-Control-Allow-Origin' header contains multiple values 'http://pwd10_0_9_3-8080.play-with-docker.com, *', but only one is allowed. Origin 'http://pwd10_0_9_3-8080.play-with-docker.com' is therefore not allowed access.
The header is added by play-with-docker and not overwritten which means there will be two times the Access-Control-Allow-Origin
header transmitted over the network. You can see that in Chrome via the Network Tab’s Header Inspector:
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Solving CORS problem on local development with Docker
The Access-Control-Allow-Origin header indicates the allowed origins that can consume the services provided by the requested resource. This ...
Read more >'Access-Control-Allow-Origin' with spring boot - Stack Overflow
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
Read more >Reason: CORS header 'Access-Control-Allow-Origin' missing
The response to the CORS request is missing the required Access-Control-Allow-Origin header, which is used to determine whether or not the ...
Read more >Can something in my Nginx config imply why my backend is ...
The browser sends two requests: OPTIONS pre-flight request, and then the POST ... Reason: CORS header 'Access-Control-Allow-Origin' missing.
Read more >Adding CORS support to an API proxy | Apigee Edge
Note: In the simplest case, you can return CORS headers to the client and the cross-origin request will work. More complicated cases exist...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, we forgot to add something, just re-applied it and I’m getting the same error as you. I’ll investigate and check what can be done. Thx for reportiing!.
Awesome! Tested and verified, works like a charm!