Show TOC

Function documentationRedirecting URLs Locate this document in the navigation structure

 

Inbound HTTP requests can be modified before they are forwarded to the application server. You can redirect the URL of an inbound HTTP request to a different application server or URL.

A line in the action file describes precisely one modification action. The sequence in the action file describes the sequence of execution too. You can execute multiple URL redirects consecutively in the action file. If an HTTP request is redirected, the execution of the modification actions in the action file stops.

You can link the execution of URL modifications to one or more conditions. By doing this you can, for example, can restrict the URL redirect to specific clients, protocols, times, etc.

Integration

Use the following syntax to define a URL redirect in the action file:

Syntax Syntax

  1. <operation> <pattern> <dest> [<option>]
End of the code.

The operation is case-insensitive.

Explanation of the Syntax

<operation>

The modification actions RegRedirectURL and RegIRedirectURL enable you to redirect the HTTP request to another address (application server and/or URL).

  • RegRedirectUrl: The pattern match is case-sensitive

  • RegIRedirectUrl: The pattern match is case-insensitive.

<pattern>

Pattern used for the comparison. If the URL of the HTTP request matches the pattern, the URL path is redirected by default to the URL path defined in <dest>.

<dest>

Specifies the URL to which you want to redirect the HTTP request. The substitution expression is set as the location header field in the HTTP response, which means the substitution expression specifies the target of the URL redirect.

[<option>]

  • noescape: In this case the result is not URL-encoded. By default the result is always URL-encoded (substitution of special characters: %, /, &). This option is only useful with URL rewrites and URL redirects.

  • restart: Restarts with the first defined modification action. The modification actions already executed remain valid.

  • break:Subsequent modification actions are no longer executed.

By default a temporary redirect is triggered (HTTP status code 302). As an option you can specify the HTTP status code that is to be sent to the HTTP client as the HTTP response. This can be specified as a numeric value in the range 300-399 or with the following predefined values:

  • permanent (compare HTTP status code 301)

  • temp (compare HTTP status code 302)

  • seeother (compare HTTP status code 303)

Note that although you can specify multiple options consecutively, you can only specify one status code. If you want to specify multiple options, 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.

Example

Example A:

Excerpt from the Action File:

Syntax Syntax

  1. RegIRedirectUrl ^/ping(.*) /sap/public/icman/ping$1
End of the code.

If the pattern matches (/ping; case insensitive), the HTTP request is redirected to URL /sap/public/icman/ping. If there are more characters after /ping in the HTTP request, these are appended unmodified to the new URL /sap/public/icman/ping.

Example B:

Excerpt from the Action File:

Syntax Syntax

  1. RegRedirectUrl / http://server.domain:8080/default.html [CODE=permanent]
End of the code.

If the pattern matches (address contains only /), the HTTP request is redirected to address http://server.domain:8080/default.html (status code 301).

Example C:

Excerpt from the Action File:

Syntax Syntax

  1. RegRedirectUrl ^/index.html(.*) /sap/bc/bsp/sap/ztest/index.html [CODE=temp]
End of the code.

If the pattern matches successfully, (HTTP starts with /index.html), the HTTP request is redirected to /sap/bc/bsp/sap/ztest/index.html (status code 302).