netty-socketio
netty-socketio copied to clipboard
Add CORS headers to server
Currently our Angular based project is failing to connect to our java socket-io backend. As far as we can see this happens due to the browser rejecting the connection because of an invalid CORS header.
How do you configure these headers to be correct and allow any connection from any IP?
We tried: config.setOrigin(""); config.setOrigin("[full ip]"); config.setOrigin("[full ip]:"); and various mutations similar, none seem to work though
Could you try this
config.setOrigin("*");
It adds a wildcard to the 'Access-Control-Allow-Origin' header
Could you try this
config.setOrigin("*");
It adds a wildcard to the 'Access-Control-Allow-Origin' header
does not work
I have a same probelem.Is there something way to solve this?
config.setAllowHeaders("*");
Old post but I believe this can also be solved by using the angular proxy configuration (partially an assumption, but I've had similar things with rest api's in dev environments).
More here: https://angular.io/guide/build#proxying-to-a-backend-server
Will close this issue and good luck to anyone reading this.