Forum Discussion

wixxyl_98682's avatar
wixxyl_98682
Icon for Nimbostratus rankNimbostratus
Nov 07, 2012

Catching the correct URI

Dev,

 

 

I've run into a particular sticky situation regarding some URI redirects on the F5. I've got an iRule that is redirecting the client based on the uri contained in the browser. This piece of it is working, up to a point. For some reason the client is trying to get some things that don't contain the uri, but are still relevant to the page the client is trying to load. So my question is can I make sure the F5 is taking that first client request and making it persist to that uri and not getting farmed off to another server port? I would love to do this outside of an iRule, I'm fairly incompetent as a programmer, and not very familiar with web services either. Any and all help is appreciated. Oh, here's an example of what I'm talking about to clarify:

 

[09:27:32.399] GET https://sis-ssb-dev.dev.uga.edu/TRNG/twbkwbis.P_GenMenu?name=homepage [HTTP/1.1 200 OK 106ms]

 

Hitting off of the TRNG piece of the uri.

 

[09:27:32.614] GET https://sis-ssb-dev.dev.uga.edu/css/web_defaulthome.css [HTTP/1.1 200 OK 2ms]

 

And then the TRNG disappears and that request gets farmed off to a different port on the server and it breaks. So can I make that client stick to his original request and how will the F5 differentiate?

 

7 Replies

  • What form of persistence are you currently using? Can you post your iRule (with sensitive parts changed if necessary) so we can see what's what and what's being redirected where please?
  • We currently aren't using persistence, I've tried every form of persistence short of writing a new persistence method, and to no avail. I'll post the iRule below:

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::uri] contains "/TRNG" } {

     

    pool Banner_SSB_9010

     

    } elseif { [HTTP::uri] contains "/BILD" } {

     

    pool Banner_SSB_9020

     

    } elseif { [HTTP::uri] contains "/DEVL" } {

     

    pool Banner_SSB_9030

     

    } elseif { [HTTP::uri] contains "/TEST"} {

     

    pool Banner_SSB_9040

     

    }

     

    }

     

     

    Farming the client out to specific ports on the server and redirecting to different pools.
  • OK, so you are directing traffic to each pool based on the URI; the rule looks good for that. So the issue is what, that the requests that don't contain the same URI don't go to the same Pool or Pool Member, which is it? Both URIs are accessed through the same Virtual Server? Is that/my understanding correct?
  • Right, they are all going through the same VS, which pool 9030 is the default pool/action to take, so that's where the break in the redirect occurs becuase the F5 doesn't see the URI it's set to match on. The client hits on those URIs to begin with, then the subsequent requests go to /css string with no mention of the TRNG, BILD, etc. And those strings are common across all of the builds, so I'm not sure where to go from here.
  • OK, so if you applied cookie insert persistence, we could check for the existence of that cookie perhaps, or we could insert a second cookie with the /TRNG or whatever value and check for that and keep selecting the same pool. Is there a chance a client would go to both /TRNG and /BILD etc in the same session?
  • That could be very possible, but I think once they get into the system through a login, they should be bumping around to different spots and shouldn't hit the instance again using /trng or /bild. How should I set up the cookie persistance? just use the default persistance profile, or create one specifically for this instance.
  • I'd suggest you create a new cookie profile and make sure it's a session cookie and also specify a custom name. Then you can put this at the start of the iRule to check for it's existence before checking the URI, if it exists, skip the pool specification code;

     

    
    if { [HTTP::cookie exists "persist-cookie-name"] }
    

     

     

    Hopefully I've understood your requirements!