Drops named headers from the upstream request before it reaches your
application. Pairs with header-add so lwauth has full control over
which auth-relevant headers cross the trust boundary.
Source: pkg/mutator/headers — registered as header-remove.
- Strip raw bearer / cookie / API key so the application never sees credentials.
- Remove client-spoofable headers (
X-User-Id,X-Roles) that only lwauth is allowed to set. - Hide IdP-specific headers from downstream services.
response:
- name: strip
type: header-remove
config:
upstream:
- Authorization
- Cookie
- X-Api-Key
- X-User-Id # belt-and-braces against header injection
- X-Rolesupstream is a list of header names (case-insensitive). No template
substitution — names are literal.
# values.yaml
config:
inline: |
response:
- name: strip
type: header-remove
config:
upstream: [Authorization, Cookie, X-Api-Key, X-User-Id, X-Roles]
- name: stamp
type: header-add
config:
subjectHeader: X-User-Id
upstream: { X-Tenant: "${claim:tenant}" }The order in response is significant — strip first, then stamp.
Incoming:
GET /things HTTP/1.1
Authorization: Bearer eyJ...
X-User-Id: attacker # client-supplied
X-Api-Key: ak_alice_2026After header-remove then header-add, upstream sees:
GET /things HTTP/1.1
X-User-Id: alice # set by lwauth, not the client
X-Roles: editor- Always pair with
header-add. Strip first, stamp second. - Use
header-passthroughif you want a selective allow-list instead of an explicit drop-list.
- Source: pkg/mutator/headers/headers.go.