Forum Discussion

Albert__Tase_70's avatar
Albert__Tase_70
Icon for Nimbostratus rankNimbostratus
Feb 02, 2010

re writing the url

ok I have looked into this and need some help

 

the customer wants to go to one url get redirect to another which in turn gets redirected to a third on https and wants the url the customer sees to bee X

 

thinking I may need to use the response value to accomplish this due to already tired the http:header replace host which did not work so would appreacate it if any one has done this before they do not want to due a redirect thtas already being done they just wantwhat the customers sees as the url to be x/ what ever

 

 

 

thanks

 

  • no errors just in the clients browser the url stays the same it dose not get modfied or changed

     

     

     

     

    Thanks

     

     

     

    Al Tase
  • Hi Al,

     

    Initially the client will need a valid URL to get to the virtual address, from there you can change it to other sites, howwver, you cannot change the URL on the client side w//o forcing a redirect.

     

     

    Thanks,

     

    Bhattman
  • ok so first its being redirected to the proper site unfortunenatly this is what is happening.

     

     

    Client a goes to url www.b which gets redircted to www.c/new/sessions which gets redirected to https.d the url at the ends still shows https://.b/sessions/new instead of https://.d/session/new

     

     

    its currently maintianing the original url through the redirects it it to show the ending url

     

     

     

     

    Thanks

     

     

  • If the redirects from url to another on the same webserver hitting the same virtual address then it's possible to use the LTM to send the traffic to the correct URI w/o further changing Host portion or the URI

     

     

    Bhattman
  • nope it hits one virtual server get redirect to another virtual server which inturn redirects it to the same virtual server on 443 I know why all the redirects customers apps anyway would respone with a HTTP:uri "xxx" work where buy the http uri or url would then be sent back to the client ?

     

     

     

    Thanks
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    If you're trying to rewrite the response without the user seeing a redirect then the HTTP::uri command won't quite get you there, as it won't rewrite a response URI, just a request URI. What you'd need to do is use the HTTP::header command to rewrite the locaiton.

    You can do this with the "HTTP::header replace" command. If you wanted to send a location of www.bob.com you could do:

     
     when HTTP_RESPONSE { 
       HTTP::header replace location "http://www.bob.com" 
     } 
     

    This is obviously a very basic example, but that's the command you're looking for, I think.

    Colin
  • I have tired evrything

     

     

    when HTTP_RESPONSE {

     

     

    HTTP::header replace location "testing"

     

    }

     

     

    HTTP::header replace Host "testing"

     

     

     

     

    nothing seems to work did a search on this dev site for rewriting the url tired all nothing seems to change what appears in the clients browser please help

     

     

    thanks

     

  • Hi Al,

     

     

    Can you clarify what you're trying to accomplish? Do you want LTM to send an HTTP redirect to the client with a new host and/or URI? You can do this using HTTP::redirect or HTTP::respond. Doing so would update the URL displayed in the address bar to the new location that is sent in the redirect.

     

     

    You could also rewrite the host and/our URI transparently on LTM before sending the request to the pool This would not be seen by the client and the address bar would not be updated, unless the application dynamically includes references to the requested host and/or URI in it's response headers or content.

     

     

    Another option would be to have LTM rewrite the host and/or URI in redirects that the application sends to clients. You can do this by checking for redirects with HTTP::is_redirect and rewriting the Location header with HTTP::header replace Location $new_location.

     

     

    If you can clarify what is happening now and what you need to implement, we can help you write an iRule to do it.

     

     

    Thanks,

     

    Aaron