question

diptesh1410_193094 avatar image
diptesh1410_193094 asked Cedrick Lunven answered

Authentication error - XMLHTTPRequest blocked by CORS policy

I am authenticating to conect UI gettting the below error-

Access to XMLHttpRequest at 'https://8080-a49eab3b-2ea6-45cf-854e-3f7bbbb86254.ws.us02.gitpod.io/api/credentials/test?username=KVUser&password=KVPassword&keyspace=killrvideo' from origin 'https://3000-a49eab3b-2ea6-45cf-854e-3f7bbbb86254.ws-us02.gitpod.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

8080-a49eab3b-2ea6-45cf-854e-3f7bbbb86254.ws.us02.gitpod.io/api/credentials/test?username=KVUser&password=KVPassword&keyspace=killrvideo:1 Failed to load resource: net::ERR_FAILED

localhost:3000/sockjs-node/info?t=1595583980978:1 Failed to load resource: net::ERR_CONNECTION_REFUSED

sockjs.js?9be2:1606 GET https://localhost:3000/sockjs-node/info?t=1595584016202 net::ERR_CONNECTION_REFUSED

AbstractXHRObject._start @ sockjs.js?9be2:1606

eval @ sockjs.js?9be2:1495

setTimeout (async)

AbstractXHRObject @ sockjs.js?9be2:1494

XHRCorsObject @ sockjs.js?9be2:2872

InfoAjax @ sockjs.js?9be2:356

InfoReceiver._getReceiver @ sockjs.js?9be2:539

InfoReceiver.doXhr @ sockjs.js?9be2:556

eval @ sockjs.js?9be2:525

setTimeout (async)

InfoReceiver @ sockjs.js?9be2:524

SockJS @ sockjs.js?9be2:731

SockJSClient @ SockJSClient.js?0a33:39

initSocket @ socket.js?e29c:20

eval @ socket.js?e29c:39

sockjs.js?9be2:1606 GET https://localhost:3000/sockjs-node/info?t=1595584085200 net::ERR_CONNECTION_REFUSED

AbstractXHRObject._start @ sockjs.js?9be2:1606

eval @ sockjs.js?9be2:1495

setTimeout (async)

AbstractXHRObject @ sockjs.js?9be2:1494

XHRCorsObject @ sockjs.js?9be2:2872

InfoAjax @ sockjs.js?9be2:356

InfoReceiver._getReceiver @ sockjs.js?9be2:539

InfoReceiver.doXhr @ sockjs.js?9be2:556

eval @ sockjs.js?9be2:525

setTimeout (async)

InfoReceiver @ sockjs.js?9be2:524

SockJS @ sockjs.js?9be2:731

SockJSClient @ SockJSClient.js?0a33:39

initSocket @ socket.js?e29c:20

eval @ socket.js?e29c:39

setTimeout (async)

eval @ socket.js?e29c:38

EventTarget.dispatchEvent @ sockjs.js?9be2:170

eval @ sockjs.js?9be2:970

setTimeout (async)

SockJS._close @ sockjs.js?9be2:958

SockJS._receiveInfo @ sockjs.js?9be2:787

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

eval @ sockjs.js?9be2:567

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

eval @ sockjs.js?9be2:374

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

xhr.onreadystatechange @ sockjs.js?9be2:1598

XMLHttpRequest.send (async)

AbstractXHRObject._start @ sockjs.js?9be2:1606

eval @ sockjs.js?9be2:1495

setTimeout (async)

AbstractXHRObject @ sockjs.js?9be2:1494

XHRCorsObject @ sockjs.js?9be2:2872

InfoAjax @ sockjs.js?9be2:356

InfoReceiver._getReceiver @ sockjs.js?9be2:539

InfoReceiver.doXhr @ sockjs.js?9be2:556

eval @ sockjs.js?9be2:525

setTimeout (async)

InfoReceiver @ sockjs.js?9be2:524

SockJS @ sockjs.js?9be2:731

SockJSClient @ SockJSClient.js?0a33:39

initSocket @ socket.js?e29c:20

eval @ socket.js?e29c:39

sockjs.js?9be2:1606 GET https://localhost:3000/sockjs-node/info?t=1595584218196 net::ERR_CONNECTION_REFUSED

authentication
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

bettina.swynnerton avatar image
bettina.swynnerton answered

Could you start with a fresh Gitpod? We made some changes re CORS in the Java backend, and we are surprised that you are still seeing the CORS issue.

A fresh GitPod workspace should have a file named CorsController.java

https://github.com/DataStax-Academy/cassandra-workshop-series/blob/master/week4-AppDev-api/getting-started-with-astra-java/src/main/java/com/datastax/astra/controller/CorsController.java

Thanks so much for your patience. I've not been able to reproduce the CORS issue with this change on my Windows 10 machine.

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Cedrick Lunven avatar image
Cedrick Lunven answered

Please could you test it now ? We cannot reproduce your issues but keep adding logs and countermeasures ad backend and frontend side.


Thank you

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.