Error pages and response headers#
This page covers the two answers the gateway gives on its own: the small error pages it serves, and the response headers it adds to proxied answers without overriding the app's own.
Error pages#
The errors the gateway answers itself get a small page of their own instead of Apache's default English wall: 403
(an unknown host or a refused path), 502 and 504 (the app is down or taking too long) and 503 (the signer cannot
sign). Each page is one self-contained HTML file under docker/gateway/errors/: inline CSS, system fonts, no
scripts, no external assets, dark-mode aware, and no hostname or product name in the text. They are served from
/_drawbridge/errors/, which the app hosts keep out of the proxy.
Two answers stay deliberately plain: an api path keeps its bare 401, because a script must never be handed an HTML
login page, and the /metrics endpoint keeps its empty-body 403 (and 404), because a scrape must not look like a
page. The endpoint is not routed by the gateway config, so these pages cannot reach it; if you wire it up as the
Metrics section describes, keep the empty body inside that location. tests/Unit/ErrorPagesTest.php
also pins their accessibility: WCAG 2.2 AA text contrast in both color schemes, a viewport that does not block zoom,
a visible focus outline of at least 2px, and a body text size of at least 16px with headings set in rem or em.
Response headers#
Apps send their own security headers through HELMET, so the gateway never overrides one. On every proxied answer it
adds X-Content-Type-Options: nosniff and Referrer-Policy: strict-origin-when-cross-origin with setifempty, and
an app that sends either keeps its own. When the public scheme is https it also adds
Strict-Transport-Security: max-age=31536000 the same way, with no includeSubDomains and no preload: the gateway
serves many hosts and must not decide subdomain or preload policy for them.
Protected and api paths also get Cache-Control: no-store with setifempty, so a signed-in page an app leaves
uncached cannot be served by a shared cache after the session ends. Public paths are untouched: the gateway adds no
Cache-Control there, and an app that wants its protected assets cached sends its own Cache-Control, which the
gateway never overrides.
The pages the gateway answers itself are not behind HELMET and carry their own headers, set plainly because no app
header is expected there. The /_drawbridge/ locations it owns (the OpenID Connect endpoint on each app host, the
/up check on the default host) get Cache-Control: no-store and Content-Security-Policy: frame-ancestors 'none'.
The default catch-all host adds X-Content-Type-Options: nosniff and Cache-Control: no-store to everything it
answers, including the unknown-host 403 and the error pages.
| Header | Value | Set on | How |
|---|---|---|---|
X-Content-Type-Options |
nosniff |
every proxied answer | setifempty |
Referrer-Policy |
strict-origin-when-cross-origin |
every proxied answer | setifempty |
Strict-Transport-Security |
max-age=31536000 |
every proxied answer when the public scheme is https | setifempty |
Cache-Control |
no-store |
answers on paths with login or api protection |
setifempty |
Cache-Control |
no-store |
the /_drawbridge/ locations the gateway owns |
set |
Content-Security-Policy |
frame-ancestors 'none' |
the /_drawbridge/ locations the gateway owns |
set |
X-Content-Type-Options |
nosniff |
everything the default catch-all host answers, including the unknown-host 403 and the error pages | set |
Cache-Control |
no-store |
everything the default catch-all host answers, including the unknown-host 403 and the error pages | set |