Show TOC

Function documentationDeleting, Adding, and Enhancing HTTP Header Fields Locate this document in the navigation structure

 

Incoming HTTP requests can be modified before they are forwarded to the application server. You can delete, add, or enhance (with additional values) HTTP header fields of inbound HTTP requests. A line in the action file describes precisely one modification action. The sequence in the action file defines the sequence of execution too. You can execute multiple HTTP header field modifications consecutively.

Features

Use the following syntax to define HTTP header field modifications in the action file:

Syntax Syntax

  1. <headerop> <name> [<value>]
End of the code.

The syntax is not case-sensitive.

All data for HTTP modifications and the affected HTTP header fields in the syntax is not case sensitive.

Explanation of the Syntax

<headerop>

Describes an HTTP header field modification. The following HTTP header field modifications are possible:

  • RemoveHeader: If header field <name> is contained in the HTTP request, it is deleted before the request is forwarded to the application server. RemoveHeader is the only HTTP header field modification where no value <value> is specified.

    (syntax: RemoveHeader <name>)

  • SetHeader: Sets the HTTP header field <name> to value <value>. If the header field is already set in the HTTP request, this value is overwritten by the value defined in SetHeader.

  • SetHeaderIfEmpty:HTTP header field <name> is set to value <value>; but only if the HTTP header field is not set in the HTTP request.

  • AppendHeader: If HTTP header field <name> is set in the HTTP request, the value specified in <value> is appended to the value already set in the HTTP request. If HTTP header field <name> is not set in the HTTP request, it is created with the value specified in <value>.

<name>

Name of the HTTP header field.

<value>

With HTTP header field modifications SetHeader, SetHeaderIfEmpty, and AppendHeader, you specify the value <value> that is to be set or appended depending on the <headerop> defined.

Example

The matrix below shows the various HTTP header field modifications:

Example A:

headerop

Header not set

Header set a = 5

SetHeader location 100

location = 100

location = 100

SetHeaderIfEmpty location 100

location = 100

location = 5

AppendHeader location 100

location = 100

location = 5, 100

Below are examples of HTTP header field modifications in the action file:

Example B:

Syntax Syntax

  1. SetHeader clientProtocol %{SERVER_PROTOCOL}
End of the code.

HTTP header field <name> clientProtocol is set to value <value> of variable SERVER_PROTOCOL.

Example C:

Syntax Syntax

  1. SetHeader X-SAP-WEBDISP-AP %{SERVER_ACCESS_POINTS}
End of the code.

HTTP header field <name> X-SAP-WEBDISP-AP is set to the value of variable <value> SERVER_ACCESS_POINTS.

Example D:

Syntax Syntax

  1. RemoveHeader Referer
End of the code.

HTTP header field referer is removed.