Forum Discussion
Robabob_74340
Nimbostratus
Jun 18, 2007Pass desired node in URL as query param
Hello,
I'm trying to write an irule which will direct a user to a particular node when they pass a query parameter and ignore any existing persistance. For example:
http://mysite.com/?node=alpha or http://mysite.com/?node=beta
I'm a total novice to TCL/irules etc so I appologise in advance for any silly questions.
This is what I've cobbled together from other examples I've seen.
when HTTP_REQUEST {
if { [HTTP::uri] contains "node=alpha" }{
node xxx.xxx.xxx.xxx 443
}
}
When I apply this rule it seems to recognise the query param, as without it the webpage loads but when the node=alpha is added the browser cannot load a page.
I don't know if it has an effect buy we are currently using cookie persistance on the F5's.
So any ideas as to what I've done wrong?
Cheers
Rob
- Deb_Allen_18Historic F5 AccountIf you're intending to pass encrypted traffic to an HTTPS server for only this traffic, and all other traffic unencrypted to the default pool, you'd need to apply a serverSSL profile to the virtual and selectively disable SSL on the server side like this:
when HTTP_REQUEST { set reencrypt 0 if { [HTTP::uri] contains "node=alpha" }{ node xxx.xxx.xxx.xxx 443 set reencrypt 1 } } when SERVER_CONNECTED { if { $reencrypt == 0 }{ SSL::disable } }
- Robabob_74340
Nimbostratus
Thanks for the reply Deb however I'm not sure it's what I want as I'm not splitting the traffic based on http/https I simply want to have the ability to choose which node my http/https request is served by. The code I showed was just my first irule which I was applying to a virtual server which was configured for https traffic I will also need a version for virtual servers which are running http unless I can write a global rule. I hope that makes sense? - Deb_Allen_18Historic F5 AccountYour original iRule is simple enough, but I don't understand the intended traffic flow well enough to give you a specific answer.
- Robabob_74340
Nimbostratus
Hi Deb,when HTTP_REQUEST { if { [HTTP::uri] contains "node=alpha" }{ node xxx.xxx.xxx.111 80 } elseif { [HTTP::uri] contains "node=beta" } { node xxx.xxx.xxx.112 80 } }
- Deb_Allen_18Historic F5 AccountOk, thanks for testing & the further clarification -- breaking down the problem into manageable steps like that is very helpful.
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