Incoming HTTP requests can be modified before they are forwarded to the application server. The URL can also be modified. You can rewrite both the URL path and the query string of an inbound HTTP request into another previously-defined URL path or query string.
The URL path comprises all characters before the "?" character if a query string comes after the "?".
The query string comprises all characters after the "?" character. A query string comprises all query parameters in a URL. The individual query parameters are separated by a "&".
For HTTP request "/sap/xi/send?client=100&sap-language=de&keep_context", the URL path is "/sap/xi/send", and the query string is "client=100&sap-language=de&keep_context".
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 URL rewrites consecutively. You can link the execution of HTTP header field modifications to one or more conditions.
Use the following syntax to define HTTP header field modifications in the action file:
<operation> <pattern> <dest> [<option>]
The operation is case-insensitive.
Explanation of the Syntax
<operation> |
The modification actions RegRewriteURL and RegIRewriteURL enable you to rewrite the URL of the HTTP request into another URL.
You still have the option of using rewriting the URL to the encoded path. Use the following modification action:
Caution These two modification actions should not be used for security functions (e.g. URL filters).
|
<pattern> |
Pattern used for the comparison. If query string in the HTTP request contains this pattern, the URL path is rewritten by default to the URL path defined in <dest>. Whether the query string is rewritten or not depends on whether the qsreplace and qsappend options have been specified. If both options are not set, the query string in the HTTP request is not modified. |
[<option>] |
You can specify multiple options consecutively; you separate them using commas. The use of compound (grouping of single modification actions into one block) and skip (skipping modification actions) is no longer recommended. |
The following examples illustrate the effects of modification actions on selected HTTP requests.
Example A:
Excerpt from the Action File:
RegRewriteUrl ^/ping/info /sap/public/icman/ping
Request before the URL rewrite |
Request after the URL rewrite |
/ping/info |
/sap/public/icman/ping |
Example B:
Excerpt from the Action File:
RegIRewriteUrl ^/echo(.*) /sap/bc/echo?header=1
Request before the URL rewrite |
Request after the URL rewrite |
|
URL path |
/echo |
/sap/bc/echo?header=1 |
URL path + query string |
/echo?client=100 |
/sap/bc/echo?client=100 |
HTTP request contains only the URL path:
If the pattern matches, the URL path /echo of the HTTP request is enhanced by the URL path /sap/bc/echo defined in the action file.
HTTP request contains the URL path and a query string:
In the pattern matches, the URL path /echo of the HTTP request /echo?client=100 is enhanced by the URL path /sap/bc/echo defined in the action file. The query string of the HTTP request is not modified.
Example C:
Excerpt from the Action File:
RegIRewriteUrl ^/echo(.*) /sap/bc/echo?header=1 [qsreplace]
Request before the URL rewrite |
Request after the URL rewrite |
|
URL path |
/echo |
/sap/bc/echo?header=1 |
URL path + query string |
/echo?client=100 |
/sap/bc/echo?header=1 |
HTTP request contains only the URL path:
If the pattern matches, the URL path /echo of the HTTP request is enhanced by the URL path /sap/bc/echo defined in the action file. Also, the query string header=1 specified in the action file is appended to the URL path.
HTTP request contains the URL path and a query string:
If the pattern matches, the URL path /echo of the HTTP request /echo?client=100 is enhanced by the URL path /sap/bc/echo defined in the action file. Furthermore, the query string specified in the action file overwrites the query string in the inbound HTTP request.
Example D:
Excerpt from the Action File:
RegIRewriteUrl ^/echo(.*) /sap/bc/echo?header=1 [qsappend]
Request before the URL rewrite |
Request after the URL rewrite |
|
URL path |
/echo |
/sap/bc/echo?header=1 |
URL path + query string |
/echo?client=100 |
/sap/bc/echo?client=100&header=1 |
HTTP request contains only the URL path:
If the pattern matches, the URL path /echo of the HTTP request is enhanced by the URL path /sap/bc/echo defined in the action file.
HTTP request contains the URL path and a query string:
In the pattern matches, the URL path /echo of the HTTP request /echo?client=100 is enhanced by the URL path /sap/bc/echo defined in the action file. Furthermore, the query string in the inbound request is enhanced with the query string specified in the action file.
Excerpt from the Action File:
RegRewriteUrl (.*) /path/to$1
Request before the URL rewrite |
Request after the URL rewrite |
|
URL path + query string |
/my/application/with_param('%2Fthis%2Fis%2Fnot%2Fa%2Fpath') |
/path/to/my/application/with_param('%2Fthis%2Fis%2Fnot%2Fa%2Fpath') |
Excerpt from the Action File:
RegRewriteRawUrl (.*) /path/to$1
Request before the URL rewrite |
Request after the URL rewrite |
|
URL path + query string |
/my/application/with_param('%2Fthis%2Fis%2Fnot%2Fa%2Fpath' |
/path/to/my/application/with_param('%2Fthis%2Fis%2Fnot%2Fa%2Fpath') |