For AI agents: this documentation is indexed at https://docs.united-security-providers.ch/usp-core-waap/llms.txt, and every page is available as markdown at its own address plus index.md.

Skip to content
USP Core WAAP documentation

Header Validation Basic Usage

(This section assumes you have read the section What is Coraza? )

  • Header validation checks the request headers listed below for valid syntax and length. Request headers not listed there are not validated.
  • By default, header validation is active in mode BLOCK: a request with at least one invalid header is rejected with status code 403. In mode DETECT, such requests are logged but not blocked.
  • Header validation does not depend on CRS, it is also active on routes where CRS is disabled. It is only inactive where the Coraza filter is disabled (spec.coraza.enabled or spec.routes[].coraza.enabled).
  • Header validation settings are at spec.coraza.headerValidation in the API Reference . They apply to all routes.

What is validated

Each validated header is checked in two ways:

  • Length: the value must not exceed the maximum length listed for the header.
  • Syntax: the value must match the grammar defined by the specification of the header, for most headers an RFC (e.g. RFC 9110 for the common HTTP headers). For widely used headers without a specification (e.g. X-Forwarded-For), the grammar follows common implementation practice.

The syntax check validates the form of a value, not its meaning. A value that is well-formed but makes no sense is accepted:

Value Result Why
Accept-Encoding: foozip accepted any token is a valid content coding, the value is not checked against known codings
Authorization: Token abc accepted Token is a valid authentication scheme name
Accept: text/ rejected the media subtype is missing
Accept: (text)/html rejected ( is not allowed in a media type
Value Result Why
Accept-Encoding: foozip accepted any token is a valid content coding, the value is not checked against known codings
Authorization: Token abc accepted Token is a valid authentication scheme name
Accept: text/ rejected the media subtype is missing
Accept: (text)/html rejected ( is not allowed in a media type

Excluding headers

If legitimate clients send headers that fail the validation, these can be excluded via spec.coraza.headerValidation.exceptions (header names are case-insensitive):

  • <header> excludes the header from both length and syntax validation
  • <header>/length excludes only the length validation
  • <header>/syntax excludes only the syntax validation
spec:
  [...]
  coraza:
    headerValidation:
      exceptions:
        - "authorization/length"
        - "x-legacy-client"

Introducing header validation

To introduce header validation without blocking legitimate traffic, it is recommended to first use mode DETECT, add exceptions for headers legitimately reported as invalid, and then switch to mode BLOCK:

spec:
  [...]
  coraza:
    headerValidation:
      mode: DETECT

To disable header validation completely, set spec.coraza.headerValidation.enabled to false.

Validated headers

Header Specification Max length
Accept RFC 9110 400
Accept-Charset RFC 9110 200
Accept-Encoding RFC 9110 200
Accept-Language RFC 9110 200
Accept-Ranges RFC 9110 100
Access-Control-Request-Method WHATWG Fetch 8192
Access-Control-Request-Headers WHATWG Fetch 8192
Allow RFC 9110 200
Authorization RFC 9110 4096
Proxy-Authorization RFC 9110 1200
Cache-Control RFC 9111 200
Connection RFC 9112 200
Content-Encoding RFC 9110 200
Content-Language RFC 9110 200
Content-Length RFC 9112 30
Content-Location RFC 9110 2000
Content-Range RFC 9110 200
Content-Type RFC 9110 600
Date RFC 9110 50
Expect RFC 9110 200
From RFC 9110 200
Host RFC 9110 200
HTTP2-Settings RFC 7540 8192
If-Match RFC 9110 200
If-Modified-Since RFC 9110 50
If-None-Match RFC 9110 200
If-Range RFC 9110 200
If-Unmodified-Since RFC 9110 50
Last-Modified RFC 9110 50
Location RFC 9110 8192
Max-Forwards RFC 9110 50
Origin RFC 6454 8192
Pragma RFC 9111 200
Range RFC 9110 200
Referer RFC 9110 8192
TE RFC 9110 200
Transfer-Encoding RFC 9112 200
Upgrade RFC 9110 200
User-Agent RFC 9110 400
Vary RFC 9110 200
Via RFC 9110 200
Warning RFC 9111 200
WWW-Authenticate RFC 9110 400
Forwarded RFC 7239 2000
Cookie RFC 6265 8192
Sec-WebSocket-Key RFC 6455 50
Sec-WebSocket-Version RFC 6455 50
Sec-WebSocket-Protocol RFC 6455 200
Sec-WebSocket-Extensions RFC 6455 500
Early-Data RFC 8470 10
Priority RFC 9218 64
Content-Digest RFC 9530 1024
Repr-Digest RFC 9530 1024
Want-Content-Digest RFC 9530 200
Want-Repr-Digest RFC 9530 200
Signature RFC 9421 2048
Signature-Input RFC 9421 1024
X-Forwarded-For no specification 2000
X-Forwarded-Host no specification 200
X-Forwarded-Port no specification 10
X-Forwarded-Proto no specification 50
X-Forwarded-Ssl no specification 10
Front-End-Https no specification 10
X-Forwarded-Server no specification 200
X-Forwarded-By no specification 100
X-Real-IP no specification 50
Client-IP no specification 50
True-Client-IP no specification 50
CF-Connecting-IP no specification 50
X-Client-IP no specification 50
X-Cluster-Client-IP no specification 50
Fastly-Client-IP no specification 50
X-Azure-ClientIP no specification 50
X-ProxyUser-Ip no specification 50
CF-IPCountry no specification 4
X-Original-Host no specification 200
X-Host no specification 200
X-Original-URL no specification 2000
X-Rewrite-URL no specification 2000
X-Forwarded-Path no specification 2000
X-HTTP-Method-Override no specification 20
X-HTTP-Method no specification 20
X-Method-Override no specification 20
X-Original-Method no specification 20
Sec-Fetch-Site W3C Fetch Metadata 20
Sec-Fetch-Mode W3C Fetch Metadata 20
Sec-Fetch-User W3C Fetch Metadata 10
Sec-Fetch-Dest W3C Fetch Metadata 30
Sec-Fetch-Storage-Access Storage Access Headers 20
Purpose no specification 20
Sec-Purpose Speculation Rules 30
Sec-CH-UA W3C UA-CH 300
Sec-CH-UA-Full-Version-List W3C UA-CH 500
Sec-CH-UA-Form-Factors W3C UA-CH 200
Sec-CH-UA-Mobile W3C UA-CH 10
Sec-CH-UA-Platform W3C UA-CH 100
Sec-CH-UA-Platform-Version W3C UA-CH 100
Sec-CH-UA-Full-Version W3C UA-CH 100
Sec-CH-UA-Arch W3C UA-CH 50
Sec-CH-UA-Bitness W3C UA-CH 20
Sec-CH-UA-Model W3C UA-CH 100
Sec-CH-UA-WoW64 W3C UA-CH 10
Sec-CH-Prefers-Color-Scheme User Preference CH 30
Sec-CH-Prefers-Reduced-Motion User Preference CH 30
Sec-CH-Prefers-Reduced-Transparency User Preference CH 30
Sec-CH-Prefers-Contrast User Preference CH 30
Sec-CH-Viewport-Width Responsive Image CH 20
Sec-CH-Viewport-Height Responsive Image CH 20
Sec-CH-Width Responsive Image CH 20
Sec-CH-DPR Responsive Image CH 20
Sec-CH-Device-Memory W3C Device Memory 20
Sec-CH-Downlink W3C Network Information 20
Sec-CH-RTT W3C Network Information 20
Sec-CH-ECT W3C Network Information 20
Sec-CH-Save-Data WICG Save Data 10
DPR Responsive Image CH 20
Width Responsive Image CH 20
Viewport-Width Responsive Image CH 20
Device-Memory W3C Device Memory 20
Downlink W3C Network Information 20
RTT W3C Network Information 20
ECT W3C Network Information 20
Save-Data WICG Save Data 10
X-Requested-With no specification 100
X-CSRF-Token no specification 512
X-XSRF-Token no specification 512
X-Api-Key no specification 512
X-Auth-Token no specification 1024
X-Request-Id no specification 200
X-Correlation-Id no specification 200
X-Trace-Id no specification 200
Idempotency-Key IETF draft 256
Traceparent W3C Trace Context 64
Tracestate W3C Trace Context 512
Baggage W3C Baggage 8192
DNT W3C DNT 10
Sec-GPC W3C GPC 10
Upgrade-Insecure-Requests W3C UIR 10
MIME-Version RFC 2045 20
A-IM RFC 3229 200
Depth RFC 4918 20
Destination RFC 4918 2000
If RFC 4918 2000
Lock-Token RFC 4918 2000
Overwrite RFC 4918 10
Timeout RFC 4918 200
Accept-Datetime RFC 7089 64
Prefer RFC 7240 200
Service-Worker W3C Service Workers 20
Service-Worker-Navigation-Preload no specification 200
Ping-From WHATWG HTML 2000
Ping-To WHATWG HTML 2000
Sec-CH-Prefers-Reduced-Data no specification 30
Sec-Browsing-Topics Topics API 2048
Sec-Speculation-Tags no specification 256
Attribution-Reporting-Eligible Attribution Reporting 256
Attribution-Reporting-Support Attribution Reporting 64
Sec-Ad-Auction-Fetch Protected Audience 10
Sec-Shared-Storage-Writable Shared Storage 10
Sec-Private-State-Token Private State Tokens 2048
Header Specification Max length
Accept RFC 9110 400
Accept-Charset RFC 9110 200
Accept-Encoding RFC 9110 200
Accept-Language RFC 9110 200
Accept-Ranges RFC 9110 100
Access-Control-Request-Method WHATWG Fetch 8192
Access-Control-Request-Headers WHATWG Fetch 8192
Allow RFC 9110 200
Authorization RFC 9110 4096
Proxy-Authorization RFC 9110 1200
Cache-Control RFC 9111 200
Connection RFC 9112 200
Content-Encoding RFC 9110 200
Content-Language RFC 9110 200
Content-Length RFC 9112 30
Content-Location RFC 9110 2000
Content-Range RFC 9110 200
Content-Type RFC 9110 600
Date RFC 9110 50
Expect RFC 9110 200
From RFC 9110 200
Host RFC 9110 200
HTTP2-Settings RFC 7540 8192
If-Match RFC 9110 200
If-Modified-Since RFC 9110 50
If-None-Match RFC 9110 200
If-Range RFC 9110 200
If-Unmodified-Since RFC 9110 50
Last-Modified RFC 9110 50
Location RFC 9110 8192
Max-Forwards RFC 9110 50
Origin RFC 6454 8192
Pragma RFC 9111 200
Range RFC 9110 200
Referer RFC 9110 8192
TE RFC 9110 200
Transfer-Encoding RFC 9112 200
Upgrade RFC 9110 200
User-Agent RFC 9110 400
Vary RFC 9110 200
Via RFC 9110 200
Warning RFC 9111 200
WWW-Authenticate RFC 9110 400
Forwarded RFC 7239 2000
Cookie RFC 6265 8192
Sec-WebSocket-Key RFC 6455 50
Sec-WebSocket-Version RFC 6455 50
Sec-WebSocket-Protocol RFC 6455 200
Sec-WebSocket-Extensions RFC 6455 500
Early-Data RFC 8470 10
Priority RFC 9218 64
Content-Digest RFC 9530 1024
Repr-Digest RFC 9530 1024
Want-Content-Digest RFC 9530 200
Want-Repr-Digest RFC 9530 200
Signature RFC 9421 2048
Signature-Input RFC 9421 1024
X-Forwarded-For no specification 2000
X-Forwarded-Host no specification 200
X-Forwarded-Port no specification 10
X-Forwarded-Proto no specification 50
X-Forwarded-Ssl no specification 10
Front-End-Https no specification 10
X-Forwarded-Server no specification 200
X-Forwarded-By no specification 100
X-Real-IP no specification 50
Client-IP no specification 50
True-Client-IP no specification 50
CF-Connecting-IP no specification 50
X-Client-IP no specification 50
X-Cluster-Client-IP no specification 50
Fastly-Client-IP no specification 50
X-Azure-ClientIP no specification 50
X-ProxyUser-Ip no specification 50
CF-IPCountry no specification 4
X-Original-Host no specification 200
X-Host no specification 200
X-Original-URL no specification 2000
X-Rewrite-URL no specification 2000
X-Forwarded-Path no specification 2000
X-HTTP-Method-Override no specification 20
X-HTTP-Method no specification 20
X-Method-Override no specification 20
X-Original-Method no specification 20
Sec-Fetch-Site W3C Fetch Metadata 20
Sec-Fetch-Mode W3C Fetch Metadata 20
Sec-Fetch-User W3C Fetch Metadata 10
Sec-Fetch-Dest W3C Fetch Metadata 30
Sec-Fetch-Storage-Access Storage Access Headers 20
Purpose no specification 20
Sec-Purpose Speculation Rules 30
Sec-CH-UA W3C UA-CH 300
Sec-CH-UA-Full-Version-List W3C UA-CH 500
Sec-CH-UA-Form-Factors W3C UA-CH 200
Sec-CH-UA-Mobile W3C UA-CH 10
Sec-CH-UA-Platform W3C UA-CH 100
Sec-CH-UA-Platform-Version W3C UA-CH 100
Sec-CH-UA-Full-Version W3C UA-CH 100
Sec-CH-UA-Arch W3C UA-CH 50
Sec-CH-UA-Bitness W3C UA-CH 20
Sec-CH-UA-Model W3C UA-CH 100
Sec-CH-UA-WoW64 W3C UA-CH 10
Sec-CH-Prefers-Color-Scheme User Preference CH 30
Sec-CH-Prefers-Reduced-Motion User Preference CH 30
Sec-CH-Prefers-Reduced-Transparency User Preference CH 30
Sec-CH-Prefers-Contrast User Preference CH 30
Sec-CH-Viewport-Width Responsive Image CH 20
Sec-CH-Viewport-Height Responsive Image CH 20
Sec-CH-Width Responsive Image CH 20
Sec-CH-DPR Responsive Image CH 20
Sec-CH-Device-Memory W3C Device Memory 20
Sec-CH-Downlink W3C Network Information 20
Sec-CH-RTT W3C Network Information 20
Sec-CH-ECT W3C Network Information 20
Sec-CH-Save-Data WICG Save Data 10
DPR Responsive Image CH 20
Width Responsive Image CH 20
Viewport-Width Responsive Image CH 20
Device-Memory W3C Device Memory 20
Downlink W3C Network Information 20
RTT W3C Network Information 20
ECT W3C Network Information 20
Save-Data WICG Save Data 10
X-Requested-With no specification 100
X-CSRF-Token no specification 512
X-XSRF-Token no specification 512
X-Api-Key no specification 512
X-Auth-Token no specification 1024
X-Request-Id no specification 200
X-Correlation-Id no specification 200
X-Trace-Id no specification 200
Idempotency-Key IETF draft 256
Traceparent W3C Trace Context 64
Tracestate W3C Trace Context 512
Baggage W3C Baggage 8192
DNT W3C DNT 10
Sec-GPC W3C GPC 10
Upgrade-Insecure-Requests W3C UIR 10
MIME-Version RFC 2045 20
A-IM RFC 3229 200
Depth RFC 4918 20
Destination RFC 4918 2000
If RFC 4918 2000
Lock-Token RFC 4918 2000
Overwrite RFC 4918 10
Timeout RFC 4918 200
Accept-Datetime RFC 7089 64
Prefer RFC 7240 200
Service-Worker W3C Service Workers 20
Service-Worker-Navigation-Preload no specification 200
Ping-From WHATWG HTML 2000
Ping-To WHATWG HTML 2000
Sec-CH-Prefers-Reduced-Data no specification 30
Sec-Browsing-Topics Topics API 2048
Sec-Speculation-Tags no specification 256
Attribution-Reporting-Eligible Attribution Reporting 256
Attribution-Reporting-Support Attribution Reporting 64
Sec-Ad-Auction-Fetch Protected Audience 10
Sec-Shared-Storage-Writable Shared Storage 10
Sec-Private-State-Token Private State Tokens 2048