Forum Discussion
Fletcher_Cocquy
Nimbostratus
Sep 27, 2011iRule to select test pool based on cookie/env variable?
Hi all,
we have a virtual server mapping to a pool with one apache web node.
client wants to test the new node via the virtual server.
Can we craft an iRule to direct her session to the new pool/node based on a cookie/env variable she sets beforehand ? (and then reset her session routing back to production after her testing is done?) (I imagine this kind of scheme could also integrate with the app itself so the app say picks up the cookie and announces when its in test mode)
Can someone please point me at an example of this or suggest a better way to do this with our BigIPs? (BIG-IP 10.2.1 Build 511.0 Hotfix HF3)
cheers,
Fletch
http://vmadmin.info
8 Replies
- Brian_69413
Nimbostratus
If you know her IP address, you could filter it that way. - hoolio
Cirrostratus
You could add the new member at a lower priority and then use an iRule like this to allow manual selection of it with a query string parameter and cookie:
http://devcentral.f5.com/wiki/iRules.Select_pool_member_based_on_HTTP_query_string_parameter.ashx
When you're done testing, change the priority of the new pool member to the same as the other one to have it used in normal load balancing.
Or as Brian said, if you can filter by client IP, it would be simpler to do something like this:when CLIENT_ACCEPTED { if {[IP::addr [IP::client_addr] equals 1.1.1.1]}{ node 10.1.1.1 80 } }
With this simple iRule you don't even need to add the new member to the pool. When you're done testing, just remove the iRule and add the new member to the pool.
Aaron - Michael_Yates
Nimbostratus
I agree with Brian. Filtering and routing on the Client IP Address is the easiest solution. If you have more than one IP Address to filter on / route to test this node then I would suggest using a Data Group.
Something like this:when HTTP_REQUEST { if { [IP::client_addr] equals "10.10.10.10" } { node 20.20.20.20 80 } }
IP::client_addr - http://devcentral.f5.com/wiki/iRules.IP__client_addr.ashx
node - http://devcentral.f5.com/wiki/iRules.node.ashx - Fletcher_Cocquy
Nimbostratus
Thanks for all the feedback - I am testing the member=[1,2] iRule - (the tester's IP varies) - it seems to work great - EXCEPT
I am having problems with the test node receiving traffic despite being in a lower priority group (1) than the prod node (2).
Why would this be?
Is there a better way to ensure the test node member never receives traffic unless ?member=2 is specified?
thanks - hoolio
Cirrostratus
Are clients going through a proxy to get to the virtual server? If you take the iRule off, do you see the same issue with pool member selection?
Can you try adding a OneConnect profile to the virtual server? if you're using SNAT on the serverside you can use the default OneConnect profile with a /0 source mask. Else, create a custom OneConnect profile with a /32 source mask.
Aaron - hoolio
Cirrostratus
If using OneConnect and the iRule doesn't fix the issue, can you enable debug in the HTTP_REQUEST event and reply with anonymized logs from /var/log/ltm?
Thanks, Aaron - Fletcher_Cocquy
Nimbostratus
" If you take the iRule off, do you see the same issue with pool member selection?"
NO
Looks like a bug in the iRule - I removed the iRule and the Priority Group was perfectly obeyed - as soon as I put it back in, the test node received traffic...(without member=
I tried this 2-3 times and reproduced the issue each time.
would be great to get this fixed!
thanks - hoolio
Cirrostratus
Can you enable debug on the iRule and reply with the output from /var/log/ltm?
Thanks, Aaron
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
