Skip to content

Response protection ​

Symptoms of response protection: security headers, error page cloaking, CSP reporting and answer compression.

Security headers or HSTS are missing from answers ​

  • Cause: header protection is in detect mode (the application's or the module's setting; detect wins). The upstream sends the header itself: entries and presets apply only when a header is missing, unless the entry says when: always. HSTS is sent on HTTPS answers only. X-Frame-Options is left out when the page's CSP has frame-ancestors. Or the entry is limited to other content types.
  • Check: an event's trace (the headers step shows would change in detect mode and changed in block mode); waap headers get -app NAME (mode and preset); waap headers posture.
  • Fix: run waap headers set -app NAME mode=block, or add an entry with when: always.

A page broke after enforcing headers (frames, popups, scripts) ​

  • Cause: X-Frame-Options: SAMEORIGIN stops other sites from framing the page. Cross-Origin-Opener-Policy separates popups opened across sites. The strict preset's Cross-Origin-Resource-Policy: same-origin stops other sites from loading images or scripts.
  • Check: the browser console names the header; the trace lists which headers were added.
  • Fix: add an entry for that header with the value the application needs (it replaces the preset's value), or use when: remove for it. For embedding, send frame-ancestors in the CSP.

Users see "Something went wrong" with a reference instead of the application's error ​

  • Cause: error pages are replaced (errors.enabled) for that status.
  • Check: find the event by its reference (waap events show ID): rule headers.error.cloaked, the upstream status and, with errors.capture=true, a redacted excerpt of the upstream's error. One event per path and status per minute is recorded.
  • Fix: add the path to errors.skip, narrow errors.statuses, or turn on errors.capture to keep the excerpt.

Error excerpt missing from cloaked-error events ​

  • Cause: errors.capture is off; or the error's content type is not in the response scope (waap response get, content_types); or its path is in skip; or the request is a HEAD. The page is still replaced, without an excerpt. Bodies compressed with br or zstd are not read (see waap_response_bodies_total{result="encoded"}).
  • Fix: add the content type to content_types. For br or zstd upstreams, turn on response.compress; the data plane then compresses after inspection.

CSP reports are not collected ​

  • Cause: csp_reports is off. The page has no Content-Security-Policy header: reports point only at policies that exist, so use preset=strict for a report-only one. The CSP already names its own report-uri or report-to, which is left as it is. More than 30 reports per minute from one client are refused with 429, and a report over 16 KiB with 413.
  • Check: the answer's CSP ends with report-uri /.waap/csp-report; waap headers posture -app NAME.

Answers are no longer compressed, or compressed twice ​

  • Cause: with response.compress, the data plane compresses answers of common text types over 256 bytes that the upstream did not compress. Answers the upstream already encoded are left alone. Clients that send no Accept-Encoding get plain answers.
  • Check: the answer's Content-Encoding; waap response get -app NAME.