Serverless Containers HTTP headers reference
Scaleway Serverless Containers automatically inject several HTTP headers into every incoming request. These headers provide metadata about the request, the client, and the routing path through the Scaleway infrastructure.
You can use these headers within your container logic for logging, security, and request tracing.
Injected headers reference
The following headers are available in the request object of your container.
| Header | Description |
|---|---|
X-Forwarded-For | A standard header used to identify the originating IP address of a client connecting through an HTTP proxy or load balancer. |
X-Forwarded-Proto | Indicates the protocol (HTTP or HTTPS) used by the client to connect to the container. |
X-Request-ID | A unique string assigned to each incoming request to facilitate tracing and debugging. |
Alongside those headers, the following headers are set for internal purpose. Users should be careful when using them, as their presence/contents is not guaranteed:
| Header | Description |
|---|---|
X-Envoy-External-Address | Internal. The public IP address of the client, prefer using X-Forwarded-For. |
K-Proxy-Request | Internal. Used by the underlying architecture. |
Detailed use cases
Request tracing and debugging
The X-Request-ID header is essential for distributed tracing. Each request receives a unique identifier that persists throughout the lifecycle of the request within the Scaleway ecosystem.
- Log correlation: Log the
X-Request-IDat the start of your container. If a request fails, you can use this ID to search through your Serverless Containers logs to find all entries related to that specific execution. The request ID doesn't appear by default in users logs; if wanted, users have to propagate the header value themselves. - Cross-service tracking: If your container calls another service, pass the
X-Request-IDalong to maintain a consistent trace across your architecture.
Client IP identification
While X-Forwarded-For contains the list of IP addresses the request has passed through, X-Envoy-External-Address provides a reliable way to identify the entry point of the request.
- Security and filtering: Use
X-Envoy-External-Addressto implement IP-based rate limiting or to allow/deny requests from specific geographic regions within your application logic. - Analytics: Use this address to determine the general location of your users without relying on the internal routing IPs.
Protocol enforcement
The X-Forwarded-Proto header allows your container to determine if the user is connecting over a secure connection.
- HTTPS redirection: If your container logic requires a secure connection, you can check if
X-Forwarded-Protoishttpand respond with a redirect to the HTTPS version of your endpoint.