Skip to content

APPT-1271 NextJs HTTP protocol headers (HSTS, Content-Type, CSP)#1640

Open
jsed-nhs wants to merge 11 commits intomainfrom
APPT-1271/http-headers
Open

APPT-1271 NextJs HTTP protocol headers (HSTS, Content-Type, CSP)#1640
jsed-nhs wants to merge 11 commits intomainfrom
APPT-1271/http-headers

Conversation

@jsed-nhs
Copy link
Copy Markdown
Contributor

@jsed-nhs jsed-nhs commented Apr 27, 2026

  • Apply no-sniff and https header config to nextJs config.
  • Apply CSP (Content Security Policy) to nextJs middleware as it needs to use a nonce generation and pass-through pattern to allow inline styles/scripts/fonts from nextJs own middleware generation.
  • Set no-cache pattern for nextJs pages only (still cache scripts etc...), as the dynamic nonce needs to generate each time (small performance cost but much higher security)
  • Disable 'bypassCSP' playwright config to allow new CSP policy to apply to all playwright tests.
  • Add test validation in playwright to fail the test with a [CSP] error if any exist (proof this works in screenshots below)
  • Move any and all existing inline-styles to css classes - as these fail the CSP policy.
  • Update jest tests affected by DOM change

TODO

  • (After merge) Need to investigate impact on each env as it goes through, as environment config values for the 'connect-src' policy for CSP may differ from local and CI mocked OIDC server.
Screenshot 2026-04-28 at 17 09 31 csp-ci

@jsed-nhs jsed-nhs requested a review from a team as a code owner April 27, 2026 12:14
@jsed-nhs jsed-nhs changed the title APPT-1271 Set NextJs Https headers APPT-1271 NextJs HTTP protocol headers (HSTS, Content-Type, CSP) Apr 29, 2026
@jsed-nhs jsed-nhs force-pushed the APPT-1271/http-headers branch from 418eabd to 1f7f8dc Compare April 29, 2026 14:48
@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant