Forum Discussion

Newbie_7519's avatar
Newbie_7519
Icon for Nimbostratus rankNimbostratus
Apr 06, 2007

How to add SelectedMember to URI

Could someone assist me in being able to create an iRule that will allow me to add the name of the Selected Node to the URI that is sent to the client browser? Basically, I'm trying to implement a way to always know what server a user is connected to just by looking at the URI of their browser.

 

 

Thanks in Advance !!!

 

 

I'm running v9.+

4 Replies

  • It can also be the last octet of the selected/responding servers IP Address if it makes things more simple.

     

     

    I'm not sure if this can be done without redirecting the user to another page (every time)...?
  • You'd probably be better off changing the application to insert the server name in the page content somehow.

     

     

    You could insert it into the URI in the HTTP_RESPONSE event after collecting it in the HTTP_REQUEST event (LB::selected I think), but then you'd have to also strip it back out with every HTTP_REQUEST, because if you send it to the client, it will make it's next request to that URI, which I'm assuming the app wouldn't know how to handle.

     

     

    So roughly the rule logic would have to be (I'm not in front of a box to test syntax so this is just an outline off the top of my head...)

     

     

    when HTTP_REQUEST {

     

    put URI back the way it should be

     

    select pool member

     

    put that selection in a variable

     

    lookup that variable against an array of names

     

    set another variable to hold the name

     

     

    when HTTP_RESPONSE {

     

    change URI to include name from previous variable

     

     

    That's a lot of extra processing it seems.

     

     

    Denny
  • I'm already running a HTTP_Request iRule for every request which validates and enforces a specific URL pattern.

     

     

    I could add a line to that which stores the selected node's IP address into a variable.

     

     

    That variable would then be available to the HTTP_Response? Such that the variable's value would be accurate to the matching HTTP_Request? I just want to make sure that the client's selected node is valid and that I can see the value in the URL.

     

     

    I'm not sharp on the syntax for modifying the URI query and such... I could not find a reference to edit the URI Query... just to read it. I'm also not sure how to set a variable that would be usable by the HTTP_Response if set by the HTTP_Request.

     

     

    Thanks for your help.

     

     

    Ryan