Skip to content
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

New option to enforce CORS in HTTP and WS transport plugins #2410

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

lminiero
Copy link
Member

As the title says, this PR adds a new option to both the HTTP and WebSocket transport plugins to actually enforce CORS. In fact, it's up to browsers to enforce CORS once the relevant headers have been exchanged, and in case of WebSockets that actually never happens anyway. This PR allows you to enforce it on the server side too, if you want: by returning a 403 in the HTTP plugin, and just closing the connection attempt in the WS plugin.

I haven't tested this much, so I'd appreciate some feedback on whether or not the way I'm dealing with this works. For instance, GET messages are known to rarely include an Origin header, which is why in the HTTP plugin I'm relying on the Referer header instead; besides, I only played a bit with Chrome, but not other browsers, so there may be other things that need fixing before this can be merged.

@lminiero
Copy link
Member Author

Merging.

@lminiero lminiero merged commit b207cbd into master Oct 30, 2020
@lminiero lminiero deleted the http-ws-origin branch October 30, 2020 09:48
PauKerr pushed a commit to caffeinetv/janus-gateway that referenced this pull request Nov 11, 2020
PauKerr pushed a commit to caffeinetv/janus-gateway that referenced this pull request Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant