You can link the execution of header field and URL manipulations to one or more conditions.
Use the following syntax for lines in the action file.
Syntax
if <string> <compop> <pattern> [op]
The values mean the following:
Name |
Meaning and Possible Values |
---|---|
<string> |
Element of the request (header field, form field, system-defined values), fixed string, or access to the relevant standard pattern match of the condition predefined directly. |
<compop> |
Comparison operation: =, !=, <, >, <=, >=, regmatch (pattern match), regimatch (pattern match case insensitive), strcmp (case sensitive character string comparison), stricmp (case insensitive character string comparison). A predefined ! negates the condition. |
<pattern> |
Regular expression used for the comparison |
[<op>] (optional) |
Joining multiple conditions: Possible operators are and and or. Unlike programming languages the operators here have equal precedence. The operators are processed from left to right. Following the the operation you can use the keywords noescape, restart, break, compound, and skip (depending on the operation). For more information, see Rewriting URLs |
if %{HTTP_HOST} regimatch *.wdf.sap.com [and]
if %{SERVER_PORT} = 80
SetHeader clientProtocol http
If the host name (value of the HTTP host header HTTP_HOST) in the HTTP request ends with .wdf.sap.com and the HTTP port of port 80 is (http://xxx.wdf.sap.com:80/...), the header field clientProtocol is set to the value http.
If %{REQUEST_METHOD} !stricmp "GET" [AND]
If %{REQUEST_METHOD} !stricmp "POST"
RegForbiddenUrl ^/(.*) -
Only requests with GET and POST are permitted as methods. All other requests are rejected.
# Rewrite Rules for ICM
If %{REQUEST_METHOD} stricmp "TRACE"
RegForbiddenUrl ^/(.*) -
HTTP requests with the TRACE method are rejected.
if %{HEADER:USER-AGENT} !regimatch Mozilla/4.0*
RegForbiddenUrl (.*) -
Only requests containing the character string Mozilla/4.0 (not case sensitive) are permitted.
If %{SERVER_PROTOCOL} !stricmp "https"
RegIRedirectUrl /sap/ (.*) https://%{HTTP_HOST}/sap/ $1 [code=permanent]
If the protocol used is not HTTPS, the request is reformulated for HTTPS.