Forum Discussion
irule which check if uri contains services
I need a irule which check if uri contains services like http://domain.name.com/services" or "oservices" then send traffic to service_pool or oservice_pool but before that it should change uri to /wps/portal instead of /services or /oservices
35 Replies
You should assign something like the following iRule to your virtual server:
when HTTP_REQUEST { if { [HTTP::uri] contains "services" } { HTTP::redirect "/wps/portal" pool SERVICE_POOL } elseif { [HTTP::uri] contains "oservices" } { HTTP::redirect "/wps/portal" pool OSERVICE_POOL } }- NewTOF501_15047
Nimbostratus
Thanks. I tried but it is sending traffic to default pool not to member of service_pool - You can add some logging to your irule to make sure that conditions in if statement work fine. And then look in /var/log/ltm for your messages. Like this: when HTTP_REQUEST { log local0. "URI = [HTTP::uri]" if { [HTTP::uri] contains "services" } { HTTP::redirect "/wps/portal" pool SERVICE_POOL log local0. "SERVICE POOL" } elseif { [HTTP::uri] contains "oservices" } { HTTP::redirect "/wps/portal" pool OSERVICE_POOL log local0. "OSERVICE_POOL" } }
- NewTOF501_15047
Nimbostratus
I added log local0 but nothing appearing in /var/log/ltm
- eddy99_235215
Nimbostratus
Hi I am new to iRule, i have this irule redirecting http trafic to WWW_Maximo_pool:
when HTTP_REQUEST { if { [HTTP::uri] contains "MAXPROD" } { pool WWW_Maximo_pool } else { HTTP::redirect https://[HTTP::host][HTTP::uri] } }
i want it to do the same redirect for HTTPS trafic, so i did the follwoing modification:
when HTTP_REQUEST or HTTPS_REQUEST { if { [HTTP::uri] contains "MAXPROD" } or { [HTTPS::uri] contains "MAXPROD" } { pool WWW_Maximo_pool } else { HTTP::redirect https://[HTTP::host][HTTP::uri] } }
but that gave me a compilation error. Any help is highly appreciated.
Thanks. Eddy.
- Jibin_43310Historic F5 Account
Change to the following:
when HTTP_REQUEST { if {{ [HTTP::uri] contains "MAXPROD" } || { [HTTPS::uri] contains "MAXPROD" }} { pool WWW_Maximo_pool } else { HTTP::redirect https://[HTTP::host][HTTP::uri] } }Same to HTTPS_REQUEST
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
