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

Fix missing custom headers and cache-control header for /_next/static #54779

Closed
wants to merge 2 commits into from
Closed

Fix missing custom headers and cache-control header for /_next/static #54779

wants to merge 2 commits into from

Conversation

cosieLq
Copy link

@cosieLq cosieLq commented Aug 30, 2023

This PR tries to fix a quite unexpected behaviour.

That is, when i18n is not configured in next.config, the server returns custom headers specified in next.config in the response for static assets (/_next/static). Whereas the server returns no custom headers when i18n is configured.

This inconsistency is especially an issue when the missing headers are security related.

Another related issue is: without i18n, the server respects the cache-control header in next.config somehow for static assets and does not overwrite it as mentioned here in https://nextjs.org/docs/pages/building-your-application/deploying/production-checklist#caching. With i18n, the cache-control header is indeed overwritten.

These inconsistencies seem to spread over dev, start and standalone mode.

Fixes #54159

Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

@cosieLq cosieLq changed the title Fix/issue 54159 Fix missing custom headers and cache-control header for /_next/static Aug 30, 2023
@cosieLq cosieLq closed this Oct 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Response headers in next.js config are not applied to standalone/_next/static (when i18n is configured)
2 participants