Only when using Javascript debug does cross domain bug occur with JB-Chrome-extension??
I have been trying to use the Webstorm debugger, grunt default server and JB-Chrome-extension with no joy.
I just get the CORS error as seen below.
However, if I simply use grunt server and chrome (Without JB-Chrome-extension) no problem.
I have added the http://*/* to the extension options with no effect.
Can someone give me a clue as to why this does not work? It would be cool to debug directly in my code editor and not the chrome-debugger..
Note: the SPA is runing on localhost:8000 and a django-rest-framework server is on localhost:9000
The error below does not make sense to me as it works outside of the JB-Chrome-debugger, but not when I attempt to use it????
-----
Failed to load http://localhost:8000/dcns/logincheck: Redirect from 'http://localhost:8000/dcns/logincheck' to 'http://localhost:8000/dcns/logincheck/' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:9000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
authService.check -> Got ERROR from login service [http://localhost:8000/] Error: error
(anonymous function) (anonymous function) processChecks $digest $apply done completeRequest requestError Possibly unhandled rejection: undefined
Please sign in to leave a comment.
Can you check if debugging without extension works? It's a new feature in 2017.3 (https://confluence.jetbrains.com/display/WI/WebStorm+EAP)
If the extension was disabled, I can debug in Chrome debugger fine.
Anyway, I found the cause, well type of.
You will see in the error that a redirect from http://host/api/logincheck redirects to http://host/api/logincheck/
with a slach on the end.. I changed the default login url in my application to INCLUDE the "/" and so the redirect no longer happned. And the problem went away!!!!
Very strange!
>If the extension was disabled, I can debug in Chrome debugger fine.
Do you mean Chrome Dev Tools? or, did you try the EAP?
>I changed the default login url in my application to INCLUDE the "/" and so the redirect no longer happned. And the problem went away!!!!
may be the issue is that the URL ended with slash doesn't match the one specified in
CORS_ORIGIN_WHITELISTof yourdjango-cors-headers?If you look at the original error it mentioned redirecting from http://localhost:8000/dcns/logincheck to http://localhost:8000/dcns/logincheck/
As the actual login url is http://localhost:8000/dcns/logincheck/
A redirect is the login request was not a good idea so I saw that so changes the javascript code to match so it did the actual
http://localhost:8000/dcns/logincheck/
This made the problem go away.
The white-list in django CORS config as mentioned above. Um, not really, see, if I didn't use the jet-brains extension the problem didn't occur and everything worked. So that indicates its good.
Really, if it works without the extension, it should work with the extension. That's the BUG here. Exactly what caused it??WHO KNOWS?? But there is defiantly some strangeness happening here.
>That's the BUG here. Exactly what caused it??WHO KNOWS??
it might be a bug indeed, but we can hardly fix it unless we have a way to recreate it. Can you provide a sample project that can be used to reproduce the issue?
Would like to help, but I have to much on my plate and building a test case would take a few hours I dont have.