A3S Docs
A3S GatewayMiddleware

Headers

Insert or overwrite HTTP headers on upstream requests and client responses

Headers

headers centralizes request and response header management.

Behavior

On the request path, request_headers are inserted into the upstream request. On the response path, response_headers are inserted into the client response. Insertions overwrite existing headers with the same name.

Invalid header names or values are skipped.

Configuration

middlewares "custom-headers" {
  type = "headers"
  request_headers = [
    { name = "X-Internal-Auth", value = env("INTERNAL_TOKEN") }
  ]
  response_headers = [
    { name = "X-Frame-Options", value = "DENY" }
  ]
}
KeyTypeDefaultNotes
typestringrequiredMust be headers.
request_headersarray<name,value>[]Added to upstream requests.
response_headersarray<name,value>[]Added to client responses.

Notes

  • Do not use this middleware to forge user identity; use JWT or Forward Auth.
  • Security headers such as CSP should be tuned to the frontend.
middlewares = ["auth-jwt", "headers", "compress"]

On this page