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

How to specify multiple origins in a CORSConfig? #2122

Open
bmeisburger opened this issue Nov 11, 2024 · 0 comments
Open

How to specify multiple origins in a CORSConfig? #2122

bmeisburger opened this issue Nov 11, 2024 · 0 comments

Comments

@bmeisburger
Copy link

bmeisburger commented Nov 11, 2024

Apologies if this is an obvious or redundant question, I'm very new to Chalice and backend web in general.

I'm trying to connect my website's frontend to my Chalice REST API. My website has two subdomains: "mywebsite.com" and "www.mywebsite.com". I would like to add both of these origins to my CORSConfig for an API route. The documentation states:

You should only supply a single origin to the CORSConfig object. If you need to supply multiple origins you will need to define a custom handler for it that accepts OPTIONS requests and matches the Origin header against a whitelist of origins. If the match is successful then return just their Origin back to them in the Access-Control-Allow-Origin header.

Is there some additional guidance, beyond this doc, on best practices for implementing this? I have no clue what this handler should look like.

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

No branches or pull requests

1 participant