HTTP headers - configuration examples
For HTTP Mode Virtual Services, HTTP header fields can be added, set, deleted, and replaced.
| For more information on configuring HTTP Headers, see Adding Layer 7 Virtual Services. |
The following examples illustrate how header rules can be used.
Example 1
A secure deployment requires that the X-Forwarded-For header field in client requests never be trusted. The header is under the control of the client and could potentially contain misinformation set by a malicious client. All header fields of this name should be deleted from incoming requests.
Create the following header rule:
| Type | Option | Name | Value |
|---|---|---|---|
Request |
Delete |
X-Forwarded-For |
- |
Example 2
A poorly designed web service behind the load balancer leaks sensitive information through an HTTP response header field. The vulnerable response field looks like so: Database-Engine: MongoDB_3.4.14. All header fields of this name should be deleted from outgoing responses.
Create the following header rule:
| Type | Option | Name | Value |
|---|---|---|---|
Response |
Delete |
Database-Engine |
- |
Example 3
A web service behind the load balancer expects to receive information about client requests via HTTP header fields. The service expects to receive the source IP address, destination IP address, and destination port of the client’s initial connection to the load balancer, which it expects to find in header fields named X-Client-Source, X-Client-Dest, and X-Client-Dest-Port, respectively. The load balancer should add these header fields to incoming requests and populate their values appropriately. The load balancer should also delete any pre-existing header fields that use the field names that the web service is logging, to prevent clients from tampering with or injecting arbitrary data into the web service’s logs.
Create the following header rules:
| Type | Option | Name | Value |
|---|---|---|---|
Request |
Set |
X-Client-Source |
%ci |
Request |
Set |
X-Client-Dest |
%fi |
Request |
Set |
X-Client-Dest-Port |
%fp |