Skip to main content
Version: 7.2402.x.x RR

HeaderDelegationFilter

The HeaderDelegationFilter can be used to delegate HTTP headers to the frontend or backend. A delegation rule has the following syntax:

<HeaderName>:<value>[;<value>]

For example, the following configuration delegates the CustomTestHeader to the frontend concatenating the constant prefix test_ with the value of the request header Connection:

<init-param>
<param-name>DelegateToFrontend</param-name>
<param-value>
CustomTestHeader:CONST:test_;HEADER:Connection
</param-value>
</init-param>

It results sending the following response header to the frontend: CustomTestHeader: test_keep-alive.

If the goal is to delegate the value of a response header, use the following configuration:

<init-param>
<param-name>DelegateToFrontend</param-name>
<param-value>
CustomTestHeader:CONST:test_;ENV:bcx.servlet.response.Header.BackendID
</param-value>
</init-param>

If the frontend or the backend sends a header with the same name (header names are case-insensitive), the one configured by the HeaderDelegationFilter takes precedence and the other one is ignored unless delegated explicitly.

The semicolon is used as a separator for the different values, therefore handled as a special character. If the delegated header has to contain it, it can be inserted in the following way:

<init-param>
<param-name>DelegateToFrontend</param-name>
<param-value>
TestHeader:CONST:firstValue;; CONST:secondValue
</param-value>
</init-param>

This results in the header TestHeader: firstValue; secondValue.

Classname
ch::nevis::isiweb4::filter::delegation::HeaderDelegationFilter
Library
libDelegationFilters.so.1

Configuration

DelegateToFrontend

Type: Newline-separated list of header delegation rules
Usage Constraints: optional, conditional
Supported pragmas: continue (default), break

Delegates headers to the frontend.

DelegateToBackend

Type: Newline-separated list of header delegation rules
Usage Constraints: optional, conditional
Supported pragmas: continue (default), break

Delegates headers to the backend.

Examples

The sample code below shows a possible configuration of the HeaderDelegationFilter:

<filter>
<filter-name>HeaderDelegationFilter</filter-name>
<filter-class>ch::nevis::isiweb4::filter::delegation::HeaderDelegationFilter</filter-class>
<init-param>
<param-name>DelegateToBackend</param-name>
<param-value>
Condition:HEADER:ToBackend:filter
ToBackend:CONST:fromFilter
Condition:HEADER:tobackend2:passthrough
NewHeader:HEADER:headerfieldsentwithrequest;CONST:setWhilePassingThrough
Always:CONST:alwaysSet
</param-value>
</init-param>
<init-param>
<param-name>DelegateToFrontend</param-name>
<param-value>
Condition:HEADER:ToFrontend:filtertest
ToFrontend:CONST:newValue
Condition:HEADER:tofrontend2:envvalue
SessionID:ENV:bcx.servlet.session.HttpSessionId
Always:CONST:alwaysSet
</param-value>
</init-param>
</filter>