SecureHeaders GatewayFilter ファクトリ

SecureHeaders GatewayFilter ファクトリは、このブログ投稿 (英語) で行われた推奨に従って、レスポンスにいくつかのヘッダーを追加します。

次のヘッダー(デフォルト値で表示)が追加されました。

  • X-Xss-Protection:1 (mode=block)

  • Strict-Transport-Security (max-age=631138519)

  • X-Frame-Options (DENY)

  • X-Content-Type-Options (nosniff)

  • Referrer-Policy (no-referrer)

  • Content-Security-Policy (default-src 'self' https:; font-src 'self' https: data:; img-src 'self' https: data:; object-src 'none'; script-src https:; style-src 'self' https: 'unsafe-inline)'

  • X-Download-Options (noopen)

  • X-Permitted-Cross-Domain-Policies (none)

デフォルト値を変更するには、spring.cloud.gateway.filter.secure-headers 名前空間に適切なプロパティを設定します。次のプロパティを使用できます。

  • xss-protection-header

  • strict-transport-security

  • frame-options

  • content-type-options

  • referrer-policy

  • content-security-policy

  • download-options

  • permitted-cross-domain-policies

デフォルト値を無効にするには、spring.cloud.gateway.filter.secure-headers.disable プロパティをコンマ区切りの値で設定します。次の例は、その方法を示しています。

spring.cloud.gateway.filter.secure-headers.disable=x-frame-options,strict-transport-security
セキュアヘッダーを無効にするには、セキュアヘッダーの小文字のフルネームを使用する必要があります。