Forum Discussion

dyobbs_25515's avatar
dyobbs_25515
Icon for Nimbostratus rankNimbostratus
Feb 03, 2012

iRule to redirect a variable to http

Guys hi,

 

 

I'm newbie here. I wanted to create an iRule, that truncates the later part of the message from the "http://.acme.com" to http://

 

 

any help is appreciated.

 

 

Will this work?

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] starts_with ".acme.com" } {

 

HTTP::redirect "http://[HTTP::host]"

 

}

 

 

  • I have to use HTTP_referrer in it..........., i would like to have as http_referrer (which is used for that : http://en.wikipedia.org/wiki/HTTP_referer) wth the original DNS calledi replied in another discussion.

     

     

    Http_referrer in iRule

     

    http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/2161192/showtab/groupforums/Default.aspx

     

     

    Can this maintain persistent session? Any traffic that goes into this iRule should have persistent session on the cache servers.

     

    What can we put in?it seems your post is not complete. anyway, what persistence method do you want?

     

     

    is carp applicable?

     

     

    sol11362: Overview of the CARP hash algorithm

     

    http://support.f5.com/kb/en-us/solutions/public/11000/300/sol11362.html
  • Nitass,

     

     

    thanks! for the 2nd query, here's the setup:

     

     

    SETUP:

     

    1.Inbound and outbound traffic falls on the same VLAN. Using same interface.

     

    2.INBOUND: From internet to firewall to F5

     

    3.OUTBOUND: F5 to Cache servers

     

    4.Inbound VS is configured with 2 members ( Cache 1 and Cache 2)

     

    5.Used iRule to rewrite URL

     

    6. Servers are on the same VLAN as the self-ip. (only one interface active for F5)

     

     

    OPERATION:

     

    1.Client initiates HTTP request with URL: www.google.com.acme.com.nz

     

    2.URL goes to public FW IP, this get NATed then goes to the F5 box

     

    3.With iRule, acme.com.nz gets truncated, then returns back www.google.com to the client browser.

     

    4.This is working, and F5 rewrites it.

     

     

    Queries:

     

    What happens to the succeeding traffic upon rewrite?

     

    Does it go direct to the pool members?

     

    Do we need persistence on this, to make it force to go the succeeding traffic?

     

    How can we put succeeding traffic will always go to f5 for it to be cached?

     

    or will just be an iRule telling the traffic to go to pool members?

     

     

    Sorry for the lot of queries.

     

     

    I tried it on my browser. It seems like after the first hit, user gets the rewritten URL, then goes back to the normal traffic, bypassing F5.

     

     

     

    thanks!

     

  • Nitass hi,

     

     

    In simple terms, F5 needs to pass the request to proxy ( cache servers) upon rewriting the URL.

     

     

    user-->F5[rewrites URL] & [forward request] --> Proxy (Cache) / Cache acts as proxy, then respond to user.

     

     

  • i put question in your new post below.

     

     

    iRule rewrite then forward request to pool

     

    http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/2161231/showtab/groupforums/Default.aspx