Forum Discussion
cwdusheke
Jan 23, 2020Nimbostratus
irule - converting if to switch
I am trying to convert my irule from using the if to the switch. Here' s an email of my old irule. when HTTP_REQUEST { if { (([HTTP::host] contains "abc1.com") && ([HTTP::uri] == "/" )) }{ ...
- Jan 23, 2020
Hello.
Try this:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::host]] { "*abc1.com" { if { [HTTP::uri] eq "/" } { HTTP::uri "/tf/myPLAN/SponsorWelcome?cz=123456789" } } "*abc2.com" { if { [HTTP::uri] eq "/" } { HTTP::uri "/tf/myPLAN/SponsorWelcome?cz=223456789" } } "*example1.com" { HTTP::respond 301 Location "https://example11.com" } "*example2.com" { HTTP::respond 301 Location "https://example22.com" } } }
KR,
Dario.
cwdusheke
Nimbostratus
Thank you very much. I was looking through a lot of examples but not sure how to do it.
Jan 23, 2020
You're welcome :-)
Please, don't forget to mark the answer as "the best" if it was 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