Forum Discussion
How to switch between the pools based on the listening port into the Irule
How to switch between the pools based on the listening port using irule
- Whenever HTTP_Request hits with listening port 8080, it will switch to Poola and whenever HTTP_Request hits with listening port 1099, it shoukd go to pool : Poolb
Thanks and Regards Parveez
4 Replies
- Kevin_Stewart
Employee
A simple example:
when CLIENT_ACCEPTED { switch [TCP::local_port] { "8080" { pool Poola } "1099" { pool Poolb } } }You could also dump these into a string-based data group. Example:
8080 := Poola 1099 := PoolbAnd use a more dynamic version of the iRule:
when CLIENT_ACCEPTED { if { [class match [TCP::local_port] equals my_port_dg] } { pool [class match -value [TCP::local_port] equals my_port_dg] } } - Parveez_70209
Nimbostratus
ok Kevin thanks, so will try both the ways and let you know.
- Parveez_70209
Nimbostratus
And also Kevin:
By applying the below Irule, also wanted to edit/add this irule saying to redirect it to https when the traffic hit to http.
when CLIENT_ACCEPTED { switch [TCP::local_port] { "8080" { pool Poola } "1099" { pool Poolb } } }
Thanks and Regards Parveez
- Kevin_Stewart
Employee
Switch to this then:
when HTTP_REQUEST { switch [TCP::local_port] { "8080" { pool Poola } "1099" { pool Poolb } "80" { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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