We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Localhost works but any other client domain/host throws a CORS error
The text was updated successfully, but these errors were encountered:
Hey! Could you give some code to reproduce?
Sorry, something went wrong.
Here's a code sample: https://stackblitz.com/edit/vitejs-vite-2ydmyfsa?file=src%2FApp.tsx
Make sure to add a valid api key.
The same code works when in localhost or a server.
Obviously the fix here would be returning the right client headers to satisfy CORS such as
res.setHeader('Access-Control-Allow-Credentials', true) res.setHeader('Access-Control-Allow-Origin', '*') // another common pattern // res.setHeader('Access-Control-Allow-Origin', req.headers.origin); res.setHeader('Access-Control-Allow-Methods', 'GET,OPTIONS,PATCH,DELETE,POST,PUT') res.setHeader( 'Access-Control-Allow-Headers', 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version' ) if (req.method === 'OPTIONS') { res.status(200).end() return }
No branches or pull requests
Localhost works but any other client domain/host throws a CORS error
The text was updated successfully, but these errors were encountered: