Forum Discussion
Node selection via URL parameters
Hello everyone! I'm trying to do the following...
I would like to monitor individual parts of one of our applications by hitting each member within the F5 pool on a regular basis, and always with the same user (so we can trace in the logs). So what I was thinking of, was calling the application as follows:
www.myapplication.com/login.jsp?node=MNS1
with an iRule that would:
1. Read in the"node" parameter, and route traffic to a particular node based off of that parameter
2. Remove the parameter before passing on to the app
Is this doable? Is there something like this already out there? If not, are there particular docs that I should take a look at to help me out?
Thanks!
7 Replies
- What_Lies_Bene1
Cirrostratus
If you've not too many nodes this should do the trick (although I'm sure it can be improved);
when HTTP_REQUEST { if { [HTTP::uri] ! contains "MSN" } { pool x.x.x.x LB normally if URI doesn't contain MSN elseif { [HTTP::uri] ends_with "MSN1" } { node x.x.x.x port } elseif { [HTTP::uri] ends_with "MSN2" } { node x.x.x.x port }...and so on... else { return } }
- Luke_55733
Nimbostratus
Thanks Steve! I'll give that a shot and get back to you. Much appreciate the quick reply. - What_Lies_Bene1
Cirrostratus
You're welcome. I'm far from an iRule expert right now but it should work fine. Let me know either way. - hoolio
Cirrostratus
Here's another example: - nathe
Cirrocumulus
Allwhen HTTP_REQUEST { switch [findstr [HTTP::query] "node=" 5 ] { "MNS1" { HTTP::uri [string range [HTTP::uri] 0 end-10] node x.x.x.x port } "MNS2" { node y.y.y.y port HTTP::uri [string range [HTTP::uri] 0 end-10] } default { log local0. "No node= match" } } }
- nitass
Employee
e.g.[root@ve10:Active] config b virtual bar list virtual bar { snat automap destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve10:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { set node_ip [URI::query "?&[HTTP::query]" "node"] if { [scan $node_ip {%d.%d.%d.%d} a b c d] == 4 } { HTTP::uri [string trimright [string map [list "node=$node_ip" ""] [HTTP::uri]] "?"] node $a.$b.$c.$d } } } test1 [root@ve10:Active] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.20.11(58985) <-> 172.28.19.79(80) 1350967002.5006 (0.0007) C>S --------------------------------------------------------------- HEAD /login.jsp?node=200.200.200.101 HTTP/1.1 User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.79 Accept: */* --------------------------------------------------------------- New TCP connection 2: 200.200.200.10(58985) <-> 200.200.200.101(80) 1350967002.5018 (0.0010) C>S --------------------------------------------------------------- HEAD /login.jsp HTTP/1.1 User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.79 Accept: */* --------------------------------------------------------------- test2 [root@ve10:Active] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.20.11(58986) <-> 172.28.19.79(80) 1350967020.3477 (0.0010) C>S --------------------------------------------------------------- HEAD /login.jsp?node=200.200.200.111 HTTP/1.1 User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.79 Accept: */* --------------------------------------------------------------- New TCP connection 2: 200.200.200.10(58986) <-> 200.200.200.111(80) 1350967020.3489 (0.0010) C>S --------------------------------------------------------------- HEAD /login.jsp HTTP/1.1 User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.79 Accept: */* ---------------------------------------------------------------
- Luke_55733
Nimbostratus
Thanks everyone for the feedback. Looks like I'm good to go now! Very impressed with the responsiveness of this community compared to others. Thanks again.
Recent Discussions
Related Content
* 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