Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

 

Purpose

Help you to understand the Web Dispatcher header field manipulation functionality providing details on how to use it.

Overview

This page contains information about the header field manipulation in the Web Dispatcher, aiming to explain its purpose.

Syntax and Usage

In order to manipulate the header fields of a request in the Web Dispatcher, there are four possible header operations that can be performed. The Header Operations are listed below next to their correspondent effect.

HTTP Header

Description

RemoveHeader

Deletes the header field defined by the parameter <value>

SetHeader

Sets the header field <name> to the value defined in the parameter <value>

SetHeaderIfEmpty

Sets the header field <name> to the value defined in the parameter <value>, however, only if this header field is empty

AppendHeader

Appends the specified value in the parameter <value> to an existing header field defined by the parameter <name>. If there is not yet a header field defined, one is created with the value of the parameter <value>

In order to correctly manipulate the header fields, the value syntax with the above mentioned Header Operations must be used:

<Header Operation> <name> [<value>]

Important: Header field names are always case insensitive.

Using Variables 

You can use variables in order to support the header field manipulation. The supported variables are divided in five different groups and they are: Variables to Access Header Fields, Variables to Access the Request URL, Variables for Standard Request Values, Variables for SSL-Specific Values and Variables for System Values. You can see a complete list of each variable name for each of the groups mentioned in the Using Variables online help page.

Syntax

%{Variable Name}

Using Conditions

The manipulation of the header fields and the usage of variables can be linked with the execution of logical conditions, allowing you to build a more complex logic behind the header field manipulation. For a complete description and syntax regarding the usage of conditions in the header field manipulation, you can access the Defining Conditions online help page.

Syntax

if <String> <Comparison Operation> <Pattern> [Optional Condition]

Using an Action File

The action file allows you to define the actions to be performed in terms of manioulation field in a file that will be read as soon as the Web Dispatcher process is started. Actions are defined by lines. Empty lines and comment lines (first character in the line is a #) are ignored. A line in the action file defines either a condition, a header field manipulation or a URL manipulation. The parameter icm/HTTP/mod_<xx>  to activate the modification and to specify the action file. You can use variables and conditions in this manipulations, as explained in the previous chapters. You can refer to the Defining Modification Actions online help page in order to learn more about this.

Usage Example

# Modification rules for WebDisp

# set WebDisp header
SetHeader clientProtocol %{SERVER_PROTOCOL}
SetHeader X-SAP-WEBDISP-AP %{SERVER_ACCESS_POINTS}

# check for forbidden method
if %{REQUEST_METHOD} !stricmp "GET" [AND]
if %{REQUEST_METHOD} !stricmp "POST"
RegForbiddenUrl ^/(.*) -

# default request RegRewriteUrl ^/$ /index.html

# URL rewriting
if %{HTTP_HOST} regimatch ldp*
RegIRewriteUrl ^/ping(.*) /sap/public/icman/ping$1

This has the following benefits:

  • The header field clientProtocol is set to the value of the variables SERVER_PROTOCOL
  • The header field X-SAP-WEBDISP-AP is set to the value of the variable SERVER_ACCESS_POINTS
  • Only data sent with GET and POST is allowed: If the data is sent with neither the GET nor POST method, the caller gets the HTTP error FORBIDDEN.
  • URLs that consist only of the backslash ("/"), are rewritten in /index.html.
  • If the host name (value of variable HTTP_HOST) starts with ldp*, replace the /ping with /sap/public/icman/ping in URLs that start with /ping.

  • No labels