Forum Discussion
is it possible to use regex within switch block?
Hi Hannes Rapp, in the HTTP::host wiki, there is the following text:
RFC2616 (section 3.2.3) states that host header evaluation MUST be case insensitive. So it is a good practice to set the Host header value to lower case before performing comparisons. This can be done using [string tolower [HTTP::host]].
I did not know browsers always convert to lower case the host header, but if one does not, the irule can have a different behavior and it's hard to troubleshoot the issue... so I will continue to convert to lower case.
d2, even if you can use regex in switch command, regex must be used only if you can't do something else.
if you have only 2 choices like in your request, it is recommended to use the syntax I proposed to limit performance impacts:
https://devcentral.f5.com/articles/so-yeah-regex-is-bad
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