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

Remove the CSP response header on 304 response #49

Merged
merged 2 commits into from
Nov 14, 2024
Merged

Conversation

mworrell
Copy link
Member

This fixes a problem where a controller can set a Content-Security-Policy header for a request that turns out to be a 304.

If a 304 with CSP is returned then the User-Agent will use the new CSP for the cached content.
This gives a problem if in the CSP a nonce is defined, as that nonce is different for every request.

Solution is to remove the CSP header for all 304 responses.

@mworrell mworrell requested a review from mmzeeman November 13, 2024 17:19
@mworrell mworrell requested a review from pasqu4le November 13, 2024 17:28
Copy link
Member

@mmzeeman mmzeeman left a comment

Choose a reason for hiding this comment

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

That must have been quite a debugging session...

@mworrell
Copy link
Member Author

Was indeed quite a head breaker....

@mworrell mworrell merged commit 7b572b9 into master Nov 14, 2024
3 checks passed
@mworrell mworrell deleted the no-csp-304 branch November 14, 2024 07:40
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