Forum Discussion
minor irule change, but its my first one. go easy on me.
hello, I have a simple if then else type of irule, depending on what uri is presented. I need to make a couple of pools - erma2 and erma3 and add them to the irule. its below, looks pretty simple, but im curious as to if it will behave as expected - more specific first, to least specific.
the erma2* and erma3* are the ones Ive added, and Ive kept with the * pattern. So now if they type erma2blahblah it will get caught and go to the right pool, but if they type ermablahblah it will DROP down to the erma* one?
when HTTP_REQUEST { Check the requested path with wildcard matching switch -glob [HTTP::path] { "/rradmin*" { /rradmin URI log local0. "[IP::remote_addr]: Request for /rradmin sent to pool pool_rradmin_ecms.gov_new_443" pool pool_rradmin_ecms.epa.gov_443 }
"/erma2" { /erma2 URI log local0. "[IP::remote_addr]: Request for /erma2 sent to pool pool_erma2_ecms.epa.gov_new_443" pool pool_erma2_ecms.epa.gov_443 } "/erma3" { /erma3 URI log local0. "[IP::remote_addr]: Request for /erma3 sent to pool pool_erma3_ecms.epa.gov_new_443" pool pool_erma3_ecms.epa.gov_443 }
"/erma*" { /erma URI log local0. "[IP::remote_addr]: Request for /erma sent to pool pool_erma_ecms.epa.gov_new_443" pool pool_erma_ecms.epa.gov_443 } default { everything else URI log local0. "[IP::remote_addr]: Default ecms.epa.gov sent to pool_default_ecms.epa.gov_new_443" pool pool_default_ecms.epa.gov_443 } } }
- Brad_ParkerCirrus
May I suggest using something like below. Since you are trying to match based on the start of the uri, use HTTP::uri. Also, looks like the start of your uri's are the application roots, so if you match with glob(_) adding the second "/" will ensure you get the expected behavior. But, yes in theory /erma2* and /erma3* should match before getting to your /erma* switch.
when HTTP_REQUEST { Check the requested path with wildcard matching switch -glob [HTTP::uri] { "/rradmin/*" { /rradmin URI log local0. "[IP::remote_addr]: Request for /rradmin sent to pool pool_rradmin_ecms.gov_new_443" pool pool_rradmin_ecms.epa.gov_443 } "/erma2/*" { /erma2 URI log local0. "[IP::remote_addr]: Request for /erma2 sent to pool pool_erma2_ecms.epa.gov_new_443" pool pool_erma2_ecms.epa.gov_443 } "/erma3/*" { /erma3 URI log local0. "[IP::remote_addr]: Request for /erma3 sent to pool pool_erma3_ecms.epa.gov_new_443" pool pool_erma3_ecms.epa.gov_443 } "/erma/*" { /erma URI log local0. "[IP::remote_addr]: Request for /erma sent to pool pool_erma_ecms.epa.gov_new_443" pool pool_erma_ecms.epa.gov_443 } default { everything else URI log local0. "[IP::remote_addr]: Default ecms.epa.gov sent to pool_default_ecms.epa.gov_new_443" pool pool_default_ecms.epa.gov_443 } } }
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