Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Use cors_allowed_origins in AsyncServer #7

Merged
merged 1 commit into from Nov 25, 2020
Merged

Use cors_allowed_origins in AsyncServer #7

merged 1 commit into from Nov 25, 2020

Conversation

MatthewScholefield
Copy link
Contributor

I needed CORS on my entire app, so I used app.add_middleware(CORSMiddleware, ...) with a specific origin. This broke websockets because it caused duplicate headers for requests to /ws/*:

access-control-allow-origin: http://localhost:3000
access-control-allow-credentials: true
access-control-allow-credentials: true
access-control-allow-origin: http://localhost:3000

(For some reason this messed up Firefox's CORS verification) So, I tried to explicitly disabling it with cors_allowed_origins=[], but I realized the parameter wasn't being used. This PR fixes that. Note that I changed the default parameter to "*" so that the behavior would remain unchanged.

@pyropy pyropy self-requested a review November 25, 2020 20:53
@pyropy
Copy link
Owner

pyropy commented Nov 25, 2020

Thank you so much for contributing, will make sure to add you to list of contributors ❣️

Merged 🚀🎉

Repository owner locked and limited conversation to collaborators Nov 25, 2020
@pyropy pyropy merged commit 346991e into pyropy:master Nov 25, 2020
This allows controlling cors in the socket server
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants