Skip to content

Specify browser behavior for CSP headers on 304 (not modified) responses #161

@lweichselbaum

Description

@lweichselbaum

It seems that browser behave differently in case a CSP header is set on a 304 response.
E.g.:

  • Chrome uses the cached CSP header instead of the CSP header provided in the 304 response.
  • Firefox uses the CSP header provided in the 304 response instead of the cached CSP header.

In case of nonce based CSPs (which should change for every single response), Chrome's behavior doesn't break a site, if a CSP header with a new nonce is set on a 304.
While the preferred solution is probably to not set a CSP at all on 304s, it is likely that in practice not reusing the cached header will lead to (unexpected) breakages in a subset of browsers.

I think it would make sense to be consistent across browsers in handling CSP headers on 304s.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions