301 error response when trying to connect to the socket #1946
Unanswered
JeanPaulSB
asked this question in
Q&A
Replies: 1 comment 6 replies
-
You've told your nginx to return a 301 response when the user connects the http:// instead of https://. This 301 response does not include CORS headers because it doesn't even reach Python. Either expand your 301 response to include CORS headers, or have your client connect directly to the https:// endpoint. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, i've been stuck since a few days with a problem while deploying my socket using a VPS with nginx and gunicorn, I need to point that I'm running an API and the socket in the same flask app instance ( I read that this shouldn't be an issue but I'm not sure about that), the API is running fine but the socket cannot be acessed, i'm trying with postman and with the frontend that I've created and it is showing me the following errors
Access to XMLHttpRequest at 'http://concursoupb.com/socket.io/?EIO=4&transport=polling&t=OQKNdod' from origin myip has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET http://concursoupb.com/socket.io/?EIO=4&transport=polling&t=OQKNdod net::ERR_FAILED 301 (Moved Permanently)
Right below what I pointed about running the API and the socket in the same app instance
I'm gonna list below some config files of my systemd file and nginx respectively
/etc/systemd/system/backend.service
etc/nginx/sites-available/backend
Finally, my entrypoint looks like this
Some lines of the nginx access.log
- - [27/Feb/2023:19:33:54 +0000] "GET /socket.io/?EIO=4&transport=polling&t=OQKO4t6 HTTP/1.1" 301 178 "myip" "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/110.0.0.0"
Thank guys for helping me, I'm just feeling so frustrated about this since i cannot find more info about this issue and I have spent a lot of time wit this.
Beta Was this translation helpful? Give feedback.
All reactions