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

CORS behavior not aligning with documentation #59

Open
ArkenV opened this issue Dec 14, 2024 · 0 comments
Open

CORS behavior not aligning with documentation #59

ArkenV opened this issue Dec 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ArkenV
Copy link

ArkenV commented Dec 14, 2024

What version of Elysia is running?

Bun: 1.0.18, Elysia: Elysia --revision fails but it's a fresh installation as of 12/12/2024

What platform is your computer?

Darwin 23.5.0 arm64 arm

What steps can reproduce the bug?

import { Elysia } from "elysia";
import { cors } from "@elysiajs/cors";

const app = new Elysia()
  .use(cors({ origin: 'localhost:4200' }))
  .post("/test", req => req.body)
  .listen(3000);

What is the expected behavior?

I expected only requests coming from localhost:4200 to be allowed.

What do you see instead?

For some reason, the origin must be passed in as an array. ['localhost:4200'] works, but the other types (regex, true) listed in the documentation do not. I understand true would allow all traffic and wouldn't be suitable for this purpose anyway, but I just want to point out that this also isn't functioning.

Additional information

No response

Have you try removing the node_modules and bun.lockb and try again yet?

It was a brand new project specifically for illustrating this bug

@ArkenV ArkenV added the bug Something isn't working label Dec 14, 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

No branches or pull requests

1 participant