Skip to content

Connection from client refused with CORS enabled #4401

Answered by darrachequesne
maki3000 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! The allowRequest function above only allows requests without origin header, which should explain the issue:

$ curl -H "origin: https://onradr.local" "http://localhost:3000/socket.io/?EIO=4&transport=polling"
{"code":4,"message":"Forbidden"}

$ curl "http://localhost:3000/socket.io/?EIO=4&transport=polling"
0{"sid":"NY98xtObBiZ2uaQWAAAA","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":20000,"maxPayload":1000000}

Could you please explain your use case?

Also, I think the extraHeaders on the client side are not necessary (the browser takes care of the preflight requests).

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@maki3000
Comment options

@darrachequesne
Comment options

@maki3000
Comment options

Answer selected by darrachequesne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants