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
As the title says set.headers removes all the headers set by the @elysiajs/cors plugin.
@elysiajs/cors
The text was updated successfully, but these errors were encountered:
I assume that you post this on Discord as well, so basically just use
set.headers['AnyHeader'] = 'Value'
instead of
set.headers = { AnyHeader: 'a' }
Sorry, something went wrong.
If you are still strugling, I managed to get this to work following this:
app.onAfterHandle(({ request, set }) => { if (!Bun.env.FRONTEND_URL) return false; set.headers["Access-Control-Allow-Origin"] = Bun.env.FRONTEND_URL; if (request.method === "OPTIONS") { set.headers["Access-Control-Allow-Headers"] = request.headers.get("Access-Control-Request-Headers") ?? "Content-Type, Authorization"; set.headers["Access-Control-Allow-Credentials"] = "true"; set.headers["Access-Control-Allow-Methods"] = "GET, POST, DELETE, PUT, PATCH"; } }); app.use( cors({ methods: ["GET", "POST", "DELETE", "PUT", "PATCH", "OPTIONS"], origin: Bun.env.FRONTEND_URL, credentials: true, allowedHeaders: [ "Content-Type", "Authorization", "Access-Control-Allow-Headers", "Access-Control-Allow-Credentials", "Access-Control-Request-Headers", ], }) );
No branches or pull requests
As the title says set.headers removes all the headers set by the
@elysiajs/cors
plugin.The text was updated successfully, but these errors were encountered: