8000 Append SecureHeaders CSP value when upstream already provides CSP by lly835 · Pull Request #4079 · spring-cloud/spring-cloud-gateway · GitHub
[go: up one dir, main page]

Skip to content

Append SecureHeaders CSP value when upstream already provides CSP#4079

Open
lly835 wants to merge 1 commit intospring-cloud:mainfrom
lly835:fix/issue-4065
Open

Append SecureHeaders CSP value when upstream already provides CSP#4079
lly835 wants to merge 1 commit intospring-cloud:mainfrom
lly835:fix/issue-4065

Conversation

@lly835
Copy link
@lly835 lly835 commented Feb 27, 2026

Summary

  • append the configured SecureHeaders Content-Security-Policy value even when the upstream response already contains a CSP header
  • keep existing non-CSP secure headers behavior unchanged (still only added when absent)
  • document this behavior in the SecureHeaders GatewayFilter docs

Why

This makes CSP behavior consistent with the expected combined policy effect when both upstream services and Spring Cloud Gateway contribute CSP directives, while preserving existing behavior for other secure headers.

Closes #4065

Tests

  • JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home PATH="$JAVA_HOME/bin:$PATH" ./mvnw -pl spring-cloud-gateway-server-webflux -Dtest=SecureHeadersGatewayFilterFactoryUnitTests,SecureHeadersGatewayFilterFactoryTests test

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different header behavior CORS vs CSP

2 participants

0