Skip to content

Conversation

@divya2212001
Copy link

No description provided.

@sheplu
Copy link
Member

sheplu commented Nov 11, 2025

thanks for the PR but would you have a bit more context?
Checking the linked issues, it seems to be an userland issue? what is this new code providing?

@divya2212001
Copy link
Author

Thanks for the feedback!

This PR adds a dedicated test case for verifying that CORS headers are correctly applied when serving font files (.woff, .woff2, .ttf, .otf) through express.static().

The issue (#309) reports that while JS and CSS files do not trigger CORS errors, fonts do — even with valid CORS middleware setup. This test suite reproduces that scenario and ensures that the CORS middleware behavior is consistent across different static asset types.

Specifically, this code:

Applies the CORS middleware before static file serving.

Dynamically supports multiple allowed origins via process.env.ALLOWED_ORIGINS.

Verifies that allowed origins receive correct Access-Control-Allow-Origin headers.

Ensures disallowed origins do not get the CORS header, even if static files are still served.

The goal is to confirm whether the issue lies within expressjs/cors or in userland configuration when fonts are involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants