Forum Discussion

ukitsysadmin_95's avatar
ukitsysadmin_95
Icon for Nimbostratus rankNimbostratus
Nov 10, 2009

Keep original URL after HTTP::redirect

Hello

 

 

Aaron kindly wrote the following irule, which works a treat, but is it possible after the redirect to keep the original url in the browser ???

 

 

when HTTP_REQUEST {

 

 

log local0. "[IP::client_addr]:[TCP::client_port]: New [HTTP::method] request to [HTTP::host][HTTP::uri]"

 

 

if { [string tolower [HTTP::host]] starts_with "preview.www."} {

 

log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting to preview2.www.[getfield [string tolower [HTTP::host]] preview.www. 2]"

 

HTTP::redirect "http://preview2.www.[getfield [string tolower [HTTP::host]] preview.www. 2]" } }

 

 

 

 

 

although preview.www. has redirected to preview2.www can the broswer still say preview.www."any domain name"

 

 

1 Reply

  • If you want to keep the original URI, you would need to not redirect the client to a new URL. Instead you can rewrite the Host header using:

     

     

    HTTP::header replace Host "preview2.www.[getfield [string tolower [HTTP::host]] preview.www. 2]"

     

     

    If you want full blown proxying of the preview2 site, you could try the ProxyPass or ProxyPassV10 iRules in the Codeshare (Click here).

     

     

    Aaron