For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

James_78615's avatar
James_78615
Icon for Nimbostratus rankNimbostratus
Dec 16, 2009

Rewrite client browser URL without redirect

Hi,

 

 

Is it possible to rewrite the URL that is shown in the client web browser without issuing a redirect?

 

 

The following is scenario I would like achieve:

 

 

-Client goes to www.example.com

 

-ServerA 302 redirects to www2.example.com

 

-ServerB serves www2.example.com content but the client browser URL is rewritten back to www.example.com.

 

 

We can achieve this by iframing from serverA to serverB but this will break some embedded applications in the page.

 

 

Thanks

 

James

 

 

6 Replies

  • I suppose you can do the following

     
      when HTTP_REQUEST {  
         if {[HTTP::host] eq "www.example.com" } {  
          HTTP::header replace Host "www2.example.com"  
          }  
      }  
      

    This update will only affect the request to the pool member. The client will not see the update unless the web application uses the requested host header value to generate response headers and/or content.

    Does that help?

    Bhattman

  • Thanks for the help.

     

     

    I actually wanted to client browser to see "www.example.com" in the address bar even though it is accessing "www2.example.com".

     

     

    As part of our datacentre migration, the server that hosts www.example.com has a 302 redirect pointing to www2.example.com. During our cutover (before we change DNS over) we still want our customers to see www.example.com even though they are being redirected to www2.example.com.

     

     

    I'm not sure if it is possible, but is there a response code that can be sent back to the client to change the URL in the browser address bar?

     

     

    Thanks

     

    James

     

     

     

  • Hi James,

     

    What I posted up should only change the header going towards the webserver and not the browsers URI. So the clients should only see www.example.com but are infact going to www2.example.com. That is assuming that server in the pool is also hosting www2.example.com

     

     

    Bhattman
  • Hi Bhattman,

     

     

    Thats my problem, the two domains are hosted in different datacentres and I only have control over the www2.example.com server and LTM.

     

     

    Thanks

     

    James
  • Hi James,

     

    That was the missing piece to allow me to understand your problem. Well you could still do this with the same iRule I posted above, however, it would mean the pool on the other datacenter would point to your VIP for www2.example.com. Not sure if that is an option for you.

     

     

    Bhattman

     

     

  • Hi Bhattman,

     

     

    No, we don't have a F5 out there unfortunately. I think I am just going to have to live with the URL differences during the migration until the DNS A records for www.example.com are updated.

     

     

    Thanks alot for your help!

     

     

    James