Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Use cors on static files only? #270

Closed
vedantroy opened this issue Jun 4, 2022 · 1 comment
Closed

Use cors on static files only? #270

vedantroy opened this issue Jun 4, 2022 · 1 comment
Labels

Comments

@vedantroy
Copy link

I have the following line in my code:

app.use(express.static("public", { maxAge: "1h" }));

Ideally, I'd only allow cors on this route. What would be a good way to do that?

@dorward
Copy link

dorward commented Feb 22, 2024

As per the express documentation:

app.use([path,] callback [, callback...])

app.use(cors(options), express.static("public", { maxAge: "1h" }));

@IamLizu IamLizu converted this issue into discussion #327 Sep 15, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

3 participants