This topic describes the additional HTTP header fields that Application Load Balancer (ALB) supports and how to add them. You can customize these header fields to implement specific features.
Additional HTTP header fields supported by ALB
HTTP header fields are the header portion of request and response messages in the Hypertext Transfer Protocol (HTTP). You can customize HTTP header fields as needed, which may result in non-standard HTTP header fields on web servers and browsers. The following table describes the additional header fields that ALB supports.
Field name | Description | Applicable listener protocol |
X-Forwarded-For | Enable the
Field format: For more information about how ALB obtains client originating IP addresses, see Obtain client originating IP addresses on backend servers through an ALB instance. |
|
SLB-ID | Enable the |
|
X-Forwarded-Proto | Enable the Field format: |
|
X-Forwarded-Port | Enable the Field format: |
|
X-Forwarded-Host | Enable the Field format: |
|
X-Forwarded-Client-srcport | Enable the Field format: |
|
X-Forwarded-Clientcert-subjectdn | Enable the After you enable this header field, you must enter a custom HTTP header name. | HTTPS |
X-Forwarded-Clientcert-issuerdn | Enable the After you enable this header field, you must enter a custom HTTP header name. | HTTPS |
X-Forwarded-Clientcert-fingerprint | Enable the After you enable this header field, you must enter a custom HTTP header name. | HTTPS |
X-Forwarded-Clientcert-clientverify | Enable the After you enable this header field, you must enter a custom HTTP header name. | HTTPS |
Configure your backend servers to be case-insensitive when they retrieve HTTP header fields. This complies with HTTP specifications.
The first letter of the X-Forwarded-For header field that ALB passes to backend servers is always uppercase.
For other additional HTTP header fields, if a client request contains a header field, ALB passes the header field to the backend server in the same format as in the client request. Otherwise, ALB passes the header field to the backend server in the format specified in the Field name column of the preceding table.
When you enable X-Forwarded-Clientcert-subjectdn, X-Forwarded-Clientcert-issuerdn, X-Forwarded-Clientcert-fingerprint, or X-Forwarded-Clientcert-clientverify, you cannot set the custom HTTP header name to any of the following values:
slb-id,slb-ip,x-forwarded-for,x-forwarded-proto,x-forwarded-eip,x-forwarded-port,x-forwarded-client-srcport,x-forwarded-host,connection,upgrade,content-length,transfer-encoding,keep-alive,te,host,cookie,remoteip, orauthority.
Add HTTP header fields in the console
Add an HTTP header field when you create a listener
-
Log on to the ALB console.
In the top navigation bar, select the region where the ALB instance is deployed.
Use one of the following methods to open the listener configuration wizard.
On the Instances page, find the target instance and click Create Listener in the Actions column.
On the Instances page, click the ID of the target instance. Click the Listener tab and then click Create Listener.
In the Configure Listener wizard, specify the following parameters and click Next.
Listener Configuration
Description
Select Listener Protocol
Select a protocol for the listener.
Advanced Settings
Click Modify to expand the advanced configuration options.
Custom HTTP Header
Select the custom HTTP header fields that you want to enable.
NoteThis topic describes only the configurations related to header fields. For more information about other parameters, see the following topics:
Follow the on-screen instructions to complete the subsequent steps to create the listener.
Add an HTTP header field to an existing listener
-
Log on to the ALB console.
In the top navigation bar, select the region where the ALB instance is deployed.
On the Instances page, click the ID of the target instance.
Click the Listeners tab. In the Actions column of the target listener, choose
> Modify Listener.In the Modify Listener dialog box, click Modify on the right side of Advanced Settings.
In the Custom HTTP Header section, add, retain, or remove header fields, and then click Save.
Add HTTP header fields using an API
You can add header fields when you create a listener, or add, retain, or remove header fields for an existing listener.
Create a listener: Call the CreateListener API operation and configure the XForwardedForConfig parameter.
Modify an existing listener: Call the UpdateListenerAttribute API operation and update the XForwardedForConfig parameter.
References
Console operations
To forward HTTP requests using ALB, see Add an HTTP listener.
To forward HTTPS requests using ALB, see Add an HTTPS listener.
To forward QUIC requests using ALB, see Add a QUIC listener.
API references
CreateListener: Add HTTP header fields by setting the XForwardedForConfig parameter when you create an HTTP, HTTPS, or QUIC listener.
UpdateListenerAttribute: Add, retain, or remove header fields by updating the XForwardedForConfig parameter when you update the configuration of a listener.