Application Delivery (ADX)

TEMP URL rewrite: How to rewrite client URLs

by on ‎05-10-2009 09:34 AM (185 Views)

Summary

It might be necessary to rewrite the URL in incoming client requests. The web server directory structure might change and it might be important to keep existing client bookmarks alive. We will show how to insert a specified string at the beginning of the URL coming from the client.


For example, if the incoming url is "/myurl.html", we want to modify it such that it becomes "/mystring/myurl.html".

Specifics

URL Rewrite is supported for incoming traffic in clear-text HTTP or SSL (in SSL Terminate and SSL Proxy mode). It is also compatible with all other CSW functionalities, including cookie-switching, client-ip insertion etc.

Configuration

csw-rule "r10" url prefix "/"
!

csw-policy "p10"

  match "r10" forward 10

  match "r10" rewrite request-insert "mystring/"

!

server real rs18 10.1.1.18

  port http

  port http url "HEAD /"

  port http group-id  10 10

!

server real rs19 10.1.1.19

  port http

  port http url "HEAD /"

  port http group-id  10 10

!

server virtual vip1 10.45.4.240

  port http

port http csw-policy "p10"

  port http csw

  port http keep-alive

  bind http rs18 http rs19 http

Note that the match string is "/", and the inserted string is the new URL. Since any new URL starts with "/", including blank URL's, therefore, it will be matched in all conditions, and thus, we do not need any default rule!!!


Please ensure the "keep-alive" setting for the virtual server port (port http keep-alive) is part of the configuration. It is required!

Tips / Caveats

Further Reading

Check out to find out how to specify where in the request to make necessary changes