question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Access-Control-Allow-Origin fails when docker container sends "*" as Header Value

See original GitHub issue

The 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:

https://i.imgur.com/Y4VW98l.png

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marcosnilscommented, Feb 20, 2017

Was there a change in the NAT behaviour?

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!.

0reactions
cookiengineercommented, Feb 20, 2017

Awesome! Tested and verified, works like a charm!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found