Defining HTTP Request Modifications - Creating and Maintaining an Action File
Use
You can modify an HTTP request from the HTTP server (SAP Web Dispatcher or Internet Communication Manager) before it is forwarded to the application server. You define HTTP requests that you want to modify in an action file. Here you can define HTTP header field modifications, such as delete, change, and add HTTP header fields, as well as URL modifications, such as URL rewrites, URL redirects, and URL filters. You can use conditions to link modification actions.
Procedure
You define modification actions you want to execute in separate lines in a text file. One line in the action file defines precisely one modification action. The sequence in the action file defines the sequence of execution too. When an HTTP request arrives, the modification actions defined in the action file are processed in succession. In the event of a successful URL filtering or URL redirect, rule processing stops. Blank lines and comment lines are ignored when the file is executed. Comment lines are indicated by a preceding # character.
Use parameter icm/HTTP/mod_<xx> to specify the action file and to activate the modification defined in it. To improve performance, we recommend that you configure only one rewrite handler. Note that modifications in the action file are not activated until the Internet Communication Manager or SAP Web Dispatcher is restarted. If you want to activate modifications in the action file while the system is running, you have to activate them explicitly in smicm or in the ICM Web administration interface.
Example
Example of an Action File:
# 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
Meaning of the Defined Action:
SetHeader clientProtocol % {SERVER_PROTOCOL}
The header field clientProtocol is set to the value of the variable SERVER_PROTOCOL
SetHeader X-SAP-WEBDISP-AP % {SERVER_ACCESS_POINTS}
The header field X-SAP-WEBDISP-AP is set to the value of the variable SERVER_ACCESS_POINTS
if %{REQUEST_METHOD} !stricmp "GET" [AND]
if %{REQUEST_METHOD} !stricmp "POST"
RegForbiddenURL ^/(.*) -
Only data sent with the GET or POST method is allowed: If the data is not sent with GET or POST, the caller receives HTTP error FORBIDDEN.
RegRewriteURL ^/$ /index.html
URLs that consist only of the backslash ("/"), are rewritten in /index.html.
If % (HTTP_HOST) regimatch ^ ldp .*
RegIRewriteURL ^/ping(.*) /sap/public/icman/ping$1
If the host name (value of variable HTTP_HOST) starts with ldp*, in URLS that start with /ping, the /ping is replaced with /sap/public/icman/ping.