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

Supabase should be sending X-Supabase-API-Version in Access-Control-Allow-Headers HTTP header #1589

Closed
ympek opened this issue May 22, 2024 · 0 comments · Fixed by #1612
Closed
Labels
bug Something isn't working

Comments

@ympek
Copy link

ympek commented May 22, 2024

Hello everyone,

This is probably minor issue, but in cross-origin setups, the default configuration of supabase/auth does not work properly with relatively new versions on supabase/auth-js. #1377 introduced handling of X-Supabase-Api-Version header as a mechanism to choose corresponding API version, and in auth-js the client-side of this was implemented in supabase/auth-js#855.

Notice however, that this new header is not present in default CORS config in auth, as defined in internal/api/api.go line 289 thus not present in Access-Control-Allow-Headers header that supabase/auth sends. This breaks existing cross-origin setups if you update to versions past PRs mentioned.

There is simple fix of adding GOTRUE_CORS_ALLOWED_HEADERS=X-Supabase-Api-Version to environment variables, it is however not documented.

Therefore I'd suggest either adding "X-Supabase-Api-Version" (or APIVersionHeaderName) to default allowed headers for CORS, or add GOTRUE_CORS_ALLOWED_HEADERS env variable information to README (or both).

Thank you for all the great software,
BR,
ympek

@ympek ympek added the bug Something isn't working label May 22, 2024
@hf hf closed this as completed in #1612 Aug 1, 2024
@hf hf closed this as completed in 6ccd814 Aug 1, 2024
uxodb pushed a commit to uxodb/auth that referenced this issue Nov 13, 2024
LashaJini pushed a commit to LashaJini/auth that referenced this issue Nov 13, 2024
LashaJini pushed a commit to LashaJini/auth that referenced this issue Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant