Forum Discussion

farache_28983's avatar
Icon for Nimbostratus rankNimbostratus
May 14, 2012

Redirect request to different pools and rewrite the URL

I am trying to write an iRule that will rewrite the URL from a user request to a new URL and and a URI.



The request goes to: but the content is served from (different pool)




All this needs to happen on the backgroup and the client URL cannot change. So they will still see








The user will enter and be sent to While this happens the displayed URL should not change and remain




So far I've done this:






if { [HTTP::uri] ends_with "/communities/default.aspx"} {


pool cmnty_pool


} elseif { [HTTP::uri] ends_with "/communities/video"} {


pool cmnty-video_pool










but this rules does not keep the URL intact and displays the pool b URL







7 Replies

  • Are the URI's the same on both pools or is the new server doing some sort of redirect when you use the old site URI?
  • nathe's avatar
    Icon for Cirrocumulus rankCirrocumulus



    Check out Joe's blog who explains about redirection and URIs and should help you:



    So you could use something like:



    when HTTP_REQUEST {


    if { ([HTTP::host] eq "") && ([HTTP::uri] eq "/communities" } {


    HTTP::header replace "Host" ""


    HTTP::uri "/someother_uri"







    So, would be rewritten as but the browser would not change. Obviously you may have to tweak this looking at your example above but this should get you on your way.



    Does this help at all?







  • Hey brian,



    No.. the URI are not the same on either pool..




    I am the one doing the redirect to a different pool when the request comes in, so technically the request never reaches pool A when request A with URI "/communities" comes in...




    http_request to sitea--> VIP A-->Pool A (default pool)




    http_request to sitea/communities--> VIP A --> PoolB (new site with address but on the browser still has to look like "sitea/communities "




    I hope this helps




    thanks man,




  • hey Frache, Can you try this..





    when HTTP_REQUEST {


    if { ([HTTP::uri] starts_with "/communities") } {


    pool pool_b


    } else { pool pool_a }


  • John_Alam_45640's avatar
    Historic F5 Account
    I think that you need the proxypass iRule. Look at this link,




    Read the usage information carefully.



  • I understand that you are trying to get the traffic to a different pool, but I was asking whether the new pool servers require a different path in order to serve up the same content. For example, if "" translates to "", then you should do the following:

    when HTTP_REQUEST {
        if { [HTTP::uri] eq "/communities" }{
            HTTP::path "/differentcommunity"
            pool pool_b
        else {
            pool pool_a

    My guess is that the new webserver is in fact redirecting the traffic to it's URL since it does not answer to the same PATH...does that make sense?