+

Search Tips   |   Advanced Search

Rewrite action settings

We can configure settings to implement a rewrite action for outbound responses handled by the proxy server. Rewriting actions define how the proxy server rewrites elements of the uniform resource locators, such as URLs in an HTML page or the redirect link in the response. Rewrite actions are often done to mask the back-end server identity with that of the proxy server. To view this console page, click Servers > Server Types > WebSphere proxy servers > proxy_server_name > Proxy actions > action_name.


Action name

User-defined symbolic name for a rewriting action.

A rewriting action name must be unique and cannot contain an invalid character. The name field cannot contain the following characters: # \ / , : ; " * ? < > | = + & % '.


Rewriting action type

Type of rewriting action to perform. We can specify the following rewriting action types: Absolute URL response, Redirect location header, Redirect status code, Relative URL response, Set-Cookie.

table lists the rewriting action types.
Action type Description
Absolute URL response Rewrites the absolute URI in the tag attribute in the HTTP response. The proxy server scans the response for an attribute matching the From pattern. If a match of the From pattern occurs, then the proxy rewrites the response based on the To pattern. For example:
frPattern = '/(.*)'
toPattern = '/prefix/$1'
The tag <img src="http://someserver/1.jpg" /> is changed to <img src="http://someserver/prefix/1.jpg" />.
Redirect location header Rewrites the URI in the relocation header in the HTTP response. For example:
fromPattern = 'http:(.*)'
toPattern = 'https:$1'
The location header: "Location: http://www.ibm.com" is changed to "Location: https://www.ibm.com."
Redirect status code Redirect status code in the first line of a response message, such as 301 or 302.
Relative URL response Rewrites a Relative URL in tag attributes a response. The proxy server scans the response for an attribute matching the From pattern. If a match of the From pattern occurs, then the proxy will rewrite the response based on the To pattern. For example:
fromPattern = '(.*)'
toPattern = 'prefix/$1'
The tag <img src="myimages/1.jpg" /> is changed to <img src="prefix/myimages/1.jpg" />.
Relative URL response:Passive Instead of rewriting the response directly, the proxy server will inject a cookie in the response header. For example: If a request for "/myimages/1.jpg" is resent from the browser with the cookie, then the proxy server will recreate the request URI as "/prefix/myimages/1.jpg". This feature requires a browser that supports cookies and for each session, only one passive rule can be defined.
Set-Cookie_Domain Rewrites the domain attribute of the set cookie header. For example:
fromPattern = '(.*)'
toPattern = '$1.cn'
The set cookie header: "Set-Cookie: JSESSIONID: abcdefg; domain="www.ibm.com"" is changed to be "Set-Cookie: JSESSIONID: abcdefg; domain="www.ibm.com.cn""
Set-Cookie_Path Rewrites the path attribute of the set cookie header. For example:
frPattern = '(.*)'
toPattern = '/prefix$1'
The set cookie header: "Set-Cookie: JSESSIONID: abcdefg; domain="www.ibm.com"; path="/"" is changed to "Set-Cookie: JSESSIONID: abcdefg; domain="www.ibm.com"; path="/prefix/"".


From pattern

Specifies the original URL pattern in the response from the target server. The pattern can include the following wild card symbol: * . A URL pattern can have one or more asterisks (*).


To pattern

Resulting pattern after the rewrite. The pattern can include the following wild card symbol: * . A URL pattern can have one or more asterisks (*).


Enable passive rewrite

Whether or not to defer the rewriting of the URI until the subsequent request for that URI is sent by the client. Enable passive rewrite prevents the proxy server from rewriting all the links in the response before sending the response back to the client.


Cookie name

Cookie for which path or domain attributes are rewritten. This setting is only valid when the action type is Set-Cookie path or Set-Cookie domain.


Limit URL pattern

Specifies to match a request URL to rewrite in the response message. Limiting the URL pattern prevents the proxy server from rewriting all URL patterns in the response message of a certain page, allowing the proxy server to skip parsing responses for other pages if there are multiple pages. This setting is only valid when the action type is absolute URL response or relative URL response.


Limit cookie domain

Specifies a constraint to limit the rewriting of the cookie domain to only a set of specified domains. If no domains are specified, then all domains are rewritten. This field is only valid when the rewriting action type specified is Set cookie domain.


Limit cookie path

Specifies a constraint which limits rewriting the cookie path to the specified paths. If no paths are specified, then all paths are rewritten. This field is only valid when the rewriting action type specified is Set cookie path.


Related

Proxy actions collection

Reference topic