Configure HTTP Header Processing

Objective

This document provides instructions on how to configure various HTTP header processing options for your web application. The supported actions include processing headers such as request/response headers, header sizes, etc.

Using the instructions provided in this guide, you can set header processing for your services provisioned using HTTP load balancer. For more information on load balancers, see Proxy & Load Balancer.


Predefined Header Variables

Volterra provides predefined header variabes and you can use them in header processing. For example, you can set a response header to add with name as x-volterra-added and value as $[geoip_city]. This returns the city from where the request has arrived.

Refer to the following table for supprted predefined header variables and descriptions:

Header Variable Description
$[req_hdr_xxx] Fetch the request header with name. Header name(xxx) is in lower case and hyphen (-) replaced with underscore(_)
$[resp_hdr_xxx] Fetch the request header with name. Header name(xxx) is in lower case and hyphen (-) replaced with underscore(_)
$[query_params] Return all query params in the request
$[query_param_xxx] Fetch query parameter with name. Query parameter name(xxx) is in lower case and hyphen (-) replaced with underscore(_)
$[url] Returns the URL
$[path] Returns the path
$[sni] Returns the Server name identifier. Empty if SNI is absent
$[scheme] Returns HTTPS or HTTP based on the request
$[protocol] Returns HTTP protocol
$[client_address] Client address
$[original_client_address] First entry in XFF header is treated as original client address
$[server_address] Address of the upstream server that handled the request
$[status] Response code
$[src_site] Name of the VER site that received the request
$[dest_site] Name of the VER site handling the request
$[tenant] Tenant of the request
$[namespace] Namespace of the request
$[app_type] Returns the app-type for the request
$[user] Returns the user of the request.
$[geoip_country] GeoIP lookup output. Returns the country from where the request arrived
$[geoip_asn] GeoIP lookup output. Returns the ASN of the requestor
$[geoip_region] GeoIP lookup output. Returns the region from where the request arrived
$[geoip_city] GeoIP lookup output. Returns the city from where the request arrived
$[device_type] Device type of the requestor
$[browser_type] Browser Type of the requestor
$[cookie_xxx] Extract the cookie of the given name. Cookie name(xxx) is in lower case and hyphen (-) replaced with underscore(_)

Prerequisites

The following prerequisites apply:


Configuration

Perform the following steps in VoltConsole to set header processing:

Step 1: Log into VoltConsole, navigate to your load balancer, and edit it.
  • Change to your application namespace and navigate to Manage -> Load Balancers.
  • Select HTTP Load Balancers from the options and click ... -> Edit for the load balancer for your application.
Step 2: Start advanced fields configuration.
  • Navigate to the Advanced Configuration section and enable Show Advanced Fields toggle option.

Location
Figure: Add Location Option for Response Header

  • Optionally, select the Add Location checkbox. This will add the x-volterra-location header in the response messages with the value as the Regional Edge site. In case of CE sites, this option is ignored.
  • Click Configure under the More Options field. This opens the header processing configuration page.
Step 3: Configure adding request headers.
  • Click Configure under Add Request Headers field to open the request headers configuration page.
  • Click Add item under Add Request Headers field and enter the header name and value. This example shows a sample header cookie with value as ingress123. Click Apply.

ReqHeadAdd
Figure: Request Header to Add

Note: Use Add item option to specify multiple headers. Optionally, select the Append checkbox to append to existing values.

Step 4: Configure removing request headers.
  • Click Configure under Remove Request Headers field to open the request headers configuration page.
  • Click Add item under Remove Request Headers field and enter the header key. This sample sets a header x-forwarded-for for removal. This preserves the requester's original IP address by removing the x-forwarded-for header. Click Apply.

Note: The Volterra proxy adds x-forwarded-for header by default for all requests.

ReqHeadRem
Figure: Request Header to Remove

Note: Use Add item option to specify multiple headers.

Step 5: Configure adding response headers.
  • Click Configure under Add Response Headers field to open the response headers configuration page.
  • Click Add item under Add Response Headers field and enter the header name and value. This example shows a sample header cookie with value as Test1234567. Click Apply.

Note: Use Add item option to specify multiple headers. Optionally, select the Append checkbox to append to existing values.

ResHeadAdd
Figure: Response Header to Add

Note: You can set the HTTP Strict Transport Security (HSTS) by adding the Strict-Transport-Security response header and a value. A sample alue is max-age=31536000.

Step 6: Configure removing response headers.
  • Click Configure under Remove Response Headers field to open the response headers configuration page.
  • Click Add item under Remove Response Headers field and enter the header key. This sample sets a header content-length for removal. Click Apply.

ResHeadRem
Figure: Response Header to Remove

Note: Use Add item option to specify multiple headers.

Step 7: Set a maximum size for request header.

Set a value for the Maximum Request Header Size field to limit the allowed maximum size of the header in the request. The maximum value allowed is 96 KiB and default is 60 KiB.

MaxReqHead
Figure: Maximum Allowed Size for the Request Header

Step 8: Complete configuring header processing.
  • Click Apply in the More Options screen to apply the header options to the load balancer configuration.
  • Click Save and Exit in the load balancer page to save the load balancer configuration.

Concepts


API References