x-amzn-Remapped-*
The x-amzn-Remapped-* family of unofficial response headers carries the original value of a header Amazon API Gateway reserves for itself. When a backend behind a REST API answers with Date, Server, Connection or another reserved header, the gateway writes its own value under the standard name and keeps the backend's value under the prefixed name. The client receives both, so the backend value survives for debugging without changing how the gateway describes its own response.
Usage
Amazon API Gateway is the server a client talks to, and the backend
integration is a separate hop. Headers such as Connection,
Date and Content-Length describe the hop
and the body the gateway sends, so the gateway sets them itself.
Rather than discarding what the integration sent, the gateway renames
the integration's header by prefixing its name with x-amzn-Remapped-.
A Server: nginx header from the integration reaches the client as
x-amzn-Remapped-Server, next to whatever the gateway emits under the
original name. AWS documents the behaviour for REST APIs with HTTP,
HTTP proxy and Lambda integrations and labels each affected header as
passthrough, dropped, remapped or remapped with the value overwritten.
The suffix is the header name as the integration sent it, so
x-amzn-Remapped-x-amzn-RequestId holds the request identifier of an
upstream AWS service and x-amzn-Remapped-www-authenticate appears
when a Lambda function returns a lowercase www-authenticate. AWS
writes the prefix as X-Amzn-Remapped- in its documentation, while
the headers arrive on the wire as x-amzn-Remapped-. HTTP header
names are case-insensitive, so both spellings name the same field,
and a client reading the headers compares names without regard to
case. No IANA registration exists for the family.
The renaming is one-way. A header the gateway reserves in the request
direction is passed through, dropped or overwritten, and no request
header reaches the integration under the prefixed name. A separate
feature once let clients send x-amzn-remapped-<name> request headers
to overwrite values at the backend. AWS removed the feature after a
security disclosure, as the History section describes.
Remapped headers
AWS publishes the response-side treatment in a table for REST API
integrations. Eight headers are remapped. Two of them, Date and
Server, are remapped with the value overwritten, meaning the gateway
renames the header and replaces the value as well.
| Response header from the integration | Treatment |
|---|---|
| Authorization | Remapped |
| Connection | Remapped |
| Content-MD5 | Remapped |
| Date | Remapped, value overwritten |
| Max-Forwards | Remapped |
| Server | Remapped, value overwritten |
| User-Agent | Remapped |
| WWW-Authenticate | Remapped |
In observed traffic the x-amzn-Remapped-Date copy carries the same
timestamp as the gateway's own Date, and the x-amzn-Remapped-Server
copy carries the literal word Server, consistent with both values
being overwritten rather than preserved. The published table also
leaves out headers seen with the prefix in live responses:
x-amzn-Remapped-Content-Length, x-amzn-Remapped-X-Forwarded-For
and x-amzn-Remapped-x-amzn-RequestId all appear on REST API
responses, so the table describes the documented set rather than
every header the gateway renames.
Dropped headers
A second group of integration response headers is removed outright,
with no prefixed copy. Expect, Host,
Proxy-Authenticate, TE,
Transfer-Encoding, Trailer and
Upgrade are dropped for every integration type. Via
is passed through from an HTTP integration and dropped from HTTP proxy
and Lambda integrations. Accept on a response is dropped from an HTTP
integration and passed through from the other two. Everything else in
the table, including Content-Type,
Content-Encoding, Content-Length
and Range, passes through unchanged.
The request direction has its own rules. Host is overwritten
to the integration endpoint. Expect, Content-MD5, Max-Forwards,
Proxy-Authenticate, Server, TE, Trailer, Upgrade and
WWW-Authenticate are dropped before the request reaches the
integration. Transfer-Encoding is dropped for HTTP integrations and
raises an exception for Lambda integrations. Connection reaches HTTP
and HTTP proxy integrations and is dropped for Lambda. Via is the
reverse: dropped for HTTP and HTTP proxy, passed to Lambda.
Authorization passes through unless it carries a
Signature Version 4 signature or the method uses IAM authorization,
in which case the gateway consumes it. Content-Length is generated
from the body the gateway forwards.
Reading remapped values
Each prefixed header answers a question about the hop behind the
gateway. x-amzn-Remapped-Content-Length is the size of the body the
integration produced. A value different from the gateway's own
Content-Length shows the gateway replaced or re-encoded the body,
for example after a base64 decoding step for binary media types or
when the gateway answers with its own error body.
x-amzn-Remapped-x-amzn-RequestId is the request identifier of an AWS
service sitting behind the gateway, such as a second API Gateway
stage. A support case about the inner service needs
the remapped identifier, while x-amzn-RequestId
without the prefix identifies the outer gateway's own invocation.
x-amzn-Remapped-X-Forwarded-For lists the client addresses as the
inner hop saw them, which adds the gateway's egress address to the
chain visible in X-Forwarded-For.
Two gateways in a row produce a double prefix. A header the inner
gateway already renamed to x-amzn-Remapped-Date is reserved again at
the outer gateway, which renames the copy to
x-amzn-Remapped-x-amzn-Remapped-Date. Counting the prefixes on a
response counts the API Gateway hops the response crossed.
The WWW-Authenticate case has a visible effect in browsers. A
401 response from a Lambda function with
WWW-Authenticate: Basic realm="api" reaches the client as
x-amzn-Remapped-WWW-Authenticate, and the browser receives no
challenge it recognizes, so no credentials prompt appears and the
request fails silently. AWS notes the same renaming breaks the
generated Android SDK on old devices, which threw an unhandled
exception on a 401 without the standard header. HTTP Basic
authentication behind API Gateway therefore relies on a layer in
front of the gateway to issue the challenge, or on a client that reads
the prefixed header and retries with Authorization.
HTTP APIs and Lambda function URLs
AWS documents the remapping table for REST APIs. The HTTP API
documentation describes header handling in other terms: an HTTP API
translates incoming X-Forwarded-* headers into a standard
Forwarded header and appends the egress IP, host and
protocol, and it reserves a list of headers that parameter mappings
cannot add, overwrite or remove. The reserved list covers
access-control-*, apigw-*, Authorization, Connection,
Content-Encoding, Content-Length, Content-Location, Forwarded,
Keep-Alive, Origin, Proxy-Authenticate, Proxy-Authorization,
TE, Trailers, Transfer-Encoding, Upgrade, x-amz-*,
x-amzn-*, X-Forwarded-For, X-Forwarded-Host, X-Forwarded-Proto
and Via. The x-amzn-* entry means a mapping cannot create or
remove a remapped copy either. HTTP API responses identify themselves
with an apigw-requestid header, where REST API responses carry
x-amzn-RequestId and x-amz-apigw-id, which is
the quickest way to tell which gateway type produced a response under
inspection.
Lambda function URLs expose a function over HTTPS without API
Gateway. The Lambda documentation describes the response payload,
including the headers map and the cookies list the service turns
into Set-Cookie headers, and documents no renaming.
Developers report the same x-amzn-Remapped- prefix on function URL
responses, with Date renamed on every response and
www-authenticate renamed on 401 answers, so an application that
moves from API Gateway to a function URL keeps the same debugging
habits. The report is from AWS re:Post rather than the developer
guide, so the exact header set for function URLs stays unconfirmed.
Example
A REST API in front of a second API Gateway stage answers a request
for a path the inner stage does not know. The inner gateway's
Date, Content-Length, Connection, Server, X-Forwarded-For
and x-amzn-RequestId headers all come back under the prefix. The
outer gateway's own Date carries the same timestamp, its
Content-Length matches the body and x-amzn-RequestId identifies
the outer invocation. The Server copy holds the overwritten
literal. The body is the gateway's standard missing-token message.
HTTP/1.1 403 Forbidden
Content-Type: application/json
Content-Length: 42
Connection: keep-alive
Date: Tue, 03 Nov 2026 15:26:31 GMT
x-amzn-Remapped-Date: Tue, 03 Nov 2026 15:26:31 GMT
x-amzn-RequestId: 37018451-45a7-4fac-b31a-84e5ef642823
x-amzn-Remapped-x-amzn-RequestId: 3e9cd10c-beea-4991-bb34-50868c0cdf0e
x-amzn-Remapped-Content-Length: 42
x-amzn-ErrorType: MissingAuthenticationTokenException
x-amzn-Remapped-Connection: keep-alive
x-amz-apigw-id: GRR-RFgiIAMETDw=
x-amzn-Remapped-Server: Server
x-amzn-Remapped-X-Forwarded-For: 203.0.113.7, 198.51.100.21
{"message":"Missing Authentication Token"}
A Lambda function returns a 401 with a Basic challenge. The
gateway renames the challenge, so the client sees the status without
a WWW-Authenticate header and a browser shows no login prompt.
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Content-Length: 26
Connection: keep-alive
Date: Tue, 03 Nov 2026 15:26:32 GMT
x-amzn-Remapped-Date: Tue, 03 Nov 2026 15:26:32 GMT
x-amzn-RequestId: a1a2f05e-5786-47c8-ac01-1bdfe86b20ef
x-amzn-Remapped-WWW-Authenticate: Basic realm="api"
x-amz-apigw-id: GRR-UFNkliAETTw=
{"message":"Unauthorized"}
A response crossing two gateways carries a double prefix on headers both hops reserve.
x-amzn-Remapped-x-amzn-Remapped-Date: Sun, 21 Dec 2025 21:28:25 GMT
x-amzn-Remapped-x-amzn-Remapped-Content-Length: 75
x-amzn-Remapped-x-amzn-Remapped-Server: uvicorn
History
The response-side renaming is documented in the REST API section of
the developer guide's important notes, together with the dropped and
overwritten headers. The documentation also records the fallout for
the generated Android SDK, which failed on devices running Android
4.4 and earlier when a 401 arrived with
X-Amzn-Remapped-WWW-Authenticate instead of WWW-Authenticate.
A request-side counterpart existed as a documented feature: a client
sent x-amzn-remapped-<name> request headers and the gateway
stripped the prefix before the integration, overwriting any header of
the same name. Security researchers at Omegapoint reported in
November 2022 that a Lambda authorizer saw the original header while
the backend received the remapped one, letting a caller authorize as
one tenant and read another's data. AWS rolled out mitigations in May
2023 and announced on 14 June 2023 that the request header remapping
feature was removed from API Gateway, pointing customers to Velocity
Template Language mappings instead. The response-side renaming
was not part of the removal and remains in place.
See also
- x-amzn-RequestId
- X-Amzn-Trace-Id
- X-Amz-Cf-Id
- Date
- Server
- Connection
- Content-Length
- WWW-Authenticate
- Authorization
- X-Forwarded-For
- Forwarded
- Via
- Host
- User-Agent
- 401
- HTTP headers
- Amazon API Gateway important notes (REST API header table)
- Transform API requests and responses for HTTP APIs (reserved headers)
- Invoking Lambda function URLs
- Removing header remapping from Amazon API Gateway (AWS Security Blog)