Show TOC

Procedure documentationDefining HTTP Request Modifications — Creating and Maintaining an Action File Locate this document in the navigation structure

 

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.

Caution Caution

Lines:

RegIRewriteUrl ^/dtcsld(.*) /sld$1

RegForbiddenUrl /(.*) –

always send "forbidden" as the response to the HTTP client because all rules are applied in succession. If you do not want subsequent modifications to be executed after the first modification action has been applied, you have to specify this by adding a modifier (option) [break] in the relevant line.

RegIRewriteURL ^/dtcsld(.*) /sld$1 [break]

End of the caution.

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:

Syntax Syntax

  1. # Modification rules for WebDisp
  2. # set WebDisp header
  3. SetHeader clientProtocol %{SERVER_PROTOCOL}
  4. SetHeader X-SAP-WEBDISP-AP %{SERVER_ACCESS_POINTS}
  5. # check for forbidden method
  6. if %{REQUEST_METHOD} !stricmp "GET" [AND]
  7. if %{REQUEST_METHOD} !stricmp "POST"
  8. RegForbiddenURL ^/(.*) -
  9. # default request
  10. RegRewriteURL ^/$ /index.html
  11. # Url rewriting
  12. if %{HTTP_HOST} regimatch ldp*
  13. RegIRewriteURL ^/ping(.*) /sap/public/icman/ping$1
End of the code.
Meaning of the Defined Action:

Syntax Syntax

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

The header field clientProtocol is set to the value of the variable SERVER_PROTOCOL

Syntax Syntax

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

The header field X-SAP-WEBDISP-AP is set to the value of the variable SERVER_ACCESS_POINTS

Syntax Syntax

  1. if %{REQUEST_METHOD} !stricmp "GET" [AND]
  2. if %{REQUEST_METHOD} !stricmp "POST"
  3. RegForbiddenURL ^/(.*) -
End of the code.

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.

Syntax Syntax

  1. RegRewriteURL ^/$ /index.html
End of the code.

URLs that consist only of the backslash ("/"), are rewritten in /index.html.

Syntax Syntax

  1. if %{HTTP_HOST} regimatch ldp*
  2. RegIRewriteURL ^/ping(.*) /sap/public/icman/ping$1
End of the code.

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.