Forum Discussion
d2_21508
Oct 06, 2015Nimbostratus
is it possible to use regex within switch block?
Hello!
Is it possible to use regular expressions within switch block? My scenario:
a.domain.com a.domain.net
So different TLDs. Now I want to write iRule that will handle both 'com' and 'net...
Hannes_Rapp
Oct 06, 2015Nimbostratus
You can use
switch -regexp [HTTP::host]
instead of switch -glob [string tolower [HTTP::host]]
Have a look at
switch -regexp
in action in this thread: https://devcentral.f5.com/questions/disable-port-translation-in-an-irule-or-node-usage
Good luck!
- Edit: Have removed the tip where I suggested to avoid converting HTTP Host to lower-case string. Unfortunately, not all HTTP Client or Web Service Libraries are as clean as web browsers and not all of them comply with the DNS standard.
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