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

Shlairshe_84486's avatar
Shlairshe_84486
Icon for Nimbostratus rankNimbostratus
Apr 25, 2014

url/uri to url/uri with potential header rewrite involved

Ok, I think I am really close but I am finally admitting I am confused. My clients want to be able to type the url http://bearcub.dev.leo.world.com/lookout and be redirected to http://lion.dev.leo.world.com/lookout Okay, this works , with the following url, when HTTP_REQUEST { if {[string tolower [HTTP::host]] equals "bearcub.dev.leo.world.com" and [string tolower [HTTP::uri]] equals "/lookout" } { HTTP::redirect "http://lion.dev.leo.world.com/lookout" } }

 

Now, my client want to be able to type the url http://bearcub.dev.leo.world.com/lookout and be redirected to http://lion.dev.leo.world.com/lookout but want the url browser to still display http://bearcub.dev.leo.world.com/lookout so in essence, the user will be directed to the page http://lion.dev.leo.world.com/lookout but the url will still show no change , it should still show http://bearcub.dev.leo.world.com/lookout this sounds like a header re-write type of scenario which is confusing the heck out of me.

 

5 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Shlairshe,

    I think this rewrite should work. Can't lab it at the moment to test.

    when HTTP_REQUEST { 
    
      if {[string tolower [HTTP::host]] equals "bearcub.dev.leo.world.com" and [string tolower [HTTP::uri]] equals "/lookout" } { 
    
        HTTP::header replace Host "lion.dev.leo.world.com"
    
        } 
     }
    

    Hope this works, sure other DCers will correct me if wrong.

    N

  • The HTTP::redirect command sends a 302 responses to the client that will surely change the URL in the browser. If you want this to be hidden then you would, at a minimum, just change the Host header:

    when HTTP_REQUEST {
        if { ( [string tolower [HTTP::host]] equals "bearcub.dev.leo.world.com" ) and ( [string tolower [HTTP::uri]] equals "/lookout" ) } {
            HTTP::header replace Host "lion.dev.leo.world.com"
        } 
    }
    
  • The point is this. If you issue a redirect, it's the client going to get the new host resource, so the browser host URL will have to change. If you don't want to change the browser URL, then you have to silently change the Host header on ingress (request) - without the browser's involvement.

     

  • The last example I sent is what it might look like. The HTTP::header replace command will replace headers on ingress request flow without altering the client side URL.

     

  • Guys, the following worked for what I was looking for. Created a pool with the server servicing the two sites, and took your advice on the header replace statement.

     

    when HTTP_REQUEST { if { ([HTTP::uri] starts_with "/lookout") } { HTTP::header replace Host "lion.dev.leo.world.com" pool bearcub.dev.leo_pool }

     

    Thanks for sticking with it, your input did truely lead me to this resolution.

     

    Regards,