Forum Discussion
Need help combing or stacking iRules
I have 2 iRules that I either want to: 1. get working in a stacked configuration so it reads the first rule and if it's not relevant, act on the 2 rule. 2. combine the 2 rules so that the first section is read and either acted upon or ignored and then the second section takes affect.
If I place the rules individually on the VS they work as expected.
If I place them in a stacked config on the VS the first rule fails and the connection is reset.
If I combine them the first section fails when activated and the connection fails. the second section will work if the condition of the first section is false.
Rule 1: when HTTP_REQUEST { if {[active_members RHW-QA-RHW-HTTP] < 1} { pool RHW-QA-RHW-HTTP-PH } }
Rule 2 when HTTP_REQUEST { set DEBUG 0 if { $DEBUG } { log local0. "Request: [HTTP::uri]" } switch -regex [string tolower [HTTP::uri]] { "^/jobsearch.*" - { if { $DEBUG } {log local0. "Sending request to RHW-QA-RHW-HTTP-APP" } pool RHW-QA-RHW-HTTP-APP } default { pool RHW-QA-RHW-HTTP} } }
2 Replies
- nitass
Employee
If I combine them the first section fails when activated and the connection fails. the second section will work if the condition of the first section is false.
how did you combine? is it something like this?
when HTTP_REQUEST { set DEBUG 0 if {[active_members RHW-QA-RHW-HTTP] < 1} { pool RHW-QA-RHW-HTTP-PH return } if { $DEBUG } { log local0. "Request: [HTTP::uri]" } switch -regex [string tolower [HTTP::uri]] { "^/jobsearch.*" { if { $DEBUG } {log local0. "Sending request to RHW-QA-RHW-HTTP-APP" } pool RHW-QA-RHW-HTTP-APP } default { pool RHW-QA-RHW-HTTP } } }by the way, is regex really needed? can it be glob instead?
- ryan_rockwell_1
Nimbostratus
The answer worked great for me, many thanks. Now to complicate things even more. When it passes the LB check and is successful is redirecting to the secondary pool everything is great if the secondary pool is up. Where/how would I add a second set of checks to make sure that a server is available in the secondary pool? I'm thinking it would be after the switch but before the pool if that makes since.
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