-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No CORS headers are set on the client javascript file #3552
Comments
Is it me or CORS don't have to be "set" on client side... you have to tell the server which cors will be accepted. Here's my implementation to allow all in typescript this.app.use(cors({
origin: '*',
optionsSuccessStatus: 200,
})) the browser is responsible for indicating the origin domain and you have no control over that for security reasons... I might be mistaken.. Also, even if, this should probably go on the socket.io-client github :) |
The If you set the The correct headers are applied to the actual socket.io websocket connection, so I'm suggesting that the same logic is applied to the served client sources. |
I also stumble over the same issue and yes CORS needs to be set by the server also from my knowledge ;-) Can you do a PR? ;-) |
I was able to fix my CORS issues using the |
@Keepcase sorry but I do not understand it ... were yiu able to fix it or not? ;-) Or do you mean that you know how/where to fix but in engine.io and noch in socket.io?! Or what? |
My apologies @Apollon77, let me clarify. Perhaps I'm misunderstanding the issue but I was suggesting to try the change that I referenced on the socket.io server to see if that fixed the issue @aeons was running into. I recently ran into issues with CORS and the referenced comment fixed it for my use case. I was getting errors on the browser similar to socketio/engine.io#574 but I fixed it with the code referenced in socketio/engine.io#574 (comment) which I implemented on the socket.io server. I was just mentioning that the latest changes made in socketio/engine.io#279 (comment) referencing |
Can I work on it @darrachequesne |
@bilalsha sure! |
Has the issue been resolved, if not, I would like to work on it. |
I assume it is still there :-( |
@darrachequesne issue is still there ? |
The version of the `cors` package matches the one used by `engine.io`. Related: #3552
You want to:
Current behaviour
When serving the client via settings the
serveClient
option, the client is not served with the same CORS headers as the actual socket.io server.Steps to reproduce (if the current behaviour is a bug)
Start a server with
serveClient: true
and request/socket.io/socket.io.js
with anOrigin
header set.Observe that the response does not have any
Access-Control-Allow-Origin
header set.Expected behaviour
That the response has the same CORS headers as the normal operation.
Other information (e.g. stacktraces, related issues, suggestions how to fix)
This function (and the corresponding
serveMap
) should do the same origin checking as this code.The text was updated successfully, but these errors were encountered: