Add Header Filter

Purpose

The Add Header filter adds configured headers to a request and/or response.  You can use the filter to add new headers with specific values to a request chain, and it can also replace (i.e. remove any existing headers with the configured name) headers.

General filter information

Filter name: Add Header

Filter configuration: add-header.cfg.xml

Released: 6.2.2.0 

Prerequisites

Required headers: There are no required headers for this filter. 

Required preceding filters: There are no required preceding filters. 

Standard filter order: Place this filter before any filters that need to receive the added static header in the request.

Basic add header configuration

To set up the Add Header filter, edit the add-header.cfg.xml file. Within the request or response elements, define one or more header element(s):

  1. Configure the name attribute to name of the header to be added. Name is required.
  2. If you want to remove the old header, configure the overwrite attribute to true. Overwrite is optional.
  3. If you want to assign quality to users, configure the quality attribute from 0 to 1.0. Quality is optional.

The header value is given by the value of the header element.

Configurable parameters

XML schema definition

Example configuration


ElementsAttributes

Required/

Optional

Description
<add-headers>-RequiredSpecifies the sub-elements and attributes to define your add-filter configuration.

<request>

-

Required

Section to configure headers that should be added to the request.

<response>

-

Required

Section to configure headers that should be added to the response.
<header>-RequiredDefines the header to be added.
nameRequiredThe header name.
overwriteOptional

If set to false, a new header will be added with the header name and value (constructive). Default value for this attribute is false. 

If overwrite is set to true, any existing headers with the same name will be removed from the request/response before the new value is added (destructive).

qualityOptional

Quality assigned to users found in the request headers. If no quality is set, Repose will default this value to 1.0. Possible values for quality are 0 to 1.0.

Concrete Config Example

 

Use case

As a user, I want to add a static header to a set of requests/responses to satisfy client or origin service invariants, or to simplify integration with Repose.