-
-
Notifications
You must be signed in to change notification settings - Fork 750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue in enabling CORS in atmosphere client #1546
Comments
There's a CorsInterceptor that's enabled by default, maybe that's the reason. Try setting this for your Atmosphere servlet:
After that, restore your own CorsFilter to its original state and try again. |
Okay, after a closer look at the CorsInterceptor code there seems to be a bug in it. The documentation says that "true" means that the interceptor should NOT set the headers. But it actually looks like the code does the opposite. @jfarcand ? |
Heh, maybe I jumped to conclusions too fast, I just read your mailing list thread. |
Seems this issue is fixed already. Not sure what version was used. |
atmosphere-jquery-client version: "2.2.0-jquery"
Whenever the long-polling connection happens, the browser shows error as follows.
The 'Access-Control-Allow-Origin' header contains multiple values 'null, null', but only one is allowed. Origin 'null' is therefore not allowed access.
CORS Filter code :
CORS configuration in web.xml :
And in my JS client :
After facing this issue, I went into the debug mode in CORSFilter code.
There, the below code snippet gives the problem.
In the response header, it already contains as {"Access-Control-Allow-Origin" : "www.sample.com"}. And the above code snippet is adding "" to the header "Access-Control-Allow-Origin" and now the header contains multiple values as follows {"Access-Control-Allow-Origin" : " , www.sample.com"}.
So, I removed those code snippet and it is working fine.
Working CORS filter :
The text was updated successfully, but these errors were encountered: