Simple Header

The Simple Header Policy sets, updates and/or removes headers on request, response or both. The values can be literal strings, environment or system properties. Headers can be removed by simple string equality or regular expression.

The X-API-Key cannot be added to a header.

simple_header_configuration.png

Configuration Options

Add Headers

Add headers to a request, response or both, or overwrite headers.

Option

Description

Allowed Values

Header Name

Specify the name of the header to set.

any string

Header Value

Specify the value of the header to set, or key into the environment or system properties.

Any value corresponding to the value of Value Type.

Value Type

Specify how to treat the Header Value.

String

Treat as a literal string value (default).

Env

Treat as a key into the environment  Env[headerValue] , and set the returned value to the header.

System Properties

Treat as a key into the JVM’s system properties and set the returned value to the header.

Header

Treat as a header name of the incoming request and set this incoming header's value to the header.

Apply To

Specify where to apply the rule.

Request

Apply the rules to the request only (default).

Response

Apply the rules to the response only.

Both

Apply the rules to both, request and response.

Overwrite Existing

Specify whether to overwrite any existing header with same name.

true

Overwrite existing header.

false

Do not overwrite existing header (default).

Strip Headers

Remove headers matching a pattern from a request, response or both.

Option

Description

Allowed Values

Strip Header(s) That Match

Define what field to apply the pattern specified with Pattern to.

Key

Strip headers whose keys matches the specified Pattern (default).

Value

Strip headers whose values matches the specified Pattern.

With Matcher Type

Define how the pattern specified with Pattern should be handled.

String

The pattern contains a (case-insensitive) string (default).

Regex

The pattern contains a (case-insensitive) regular expression

Pattern

String to match or compile into a regex, depending on the value of with.

A valid string according to the definitions in With Matcher Type.

Apply To

Where to apply the rule.

Request

Apply the rules to the request only.

Response

Apply the rules to the response only.

Both

Apply the rules to both, request and response (default).


Related Pages: