Forum Discussion
smp_86112
Jan 03, 2014Cirrostratus
Short iRule rewrite for efficiency/readability
I have a short iRule that is simple to understand. Logically, the iRule works by checking the host header against two known values and modifies the Host: header if neither match. This is how it's cur...
- Jan 03, 2014
Don't know that you need to negate the match, just perform no action on matching "myapp1" or "myapp2" and use the default case to perform your replace.
smp_86112
Jan 03, 2014Cirrostratus
That never occurred to me. Were you thinking of something like this?
when HTTP_REQUEST {
switch -- [string tolower [HTTP::host] {
"myapp1.example.com" -
"myapp2.example.com" { }
default { HTTP::header replace "Host" [HTTP::host]:9070 }
}
}
- smp_86112Jan 03, 2014CirrostratusI tried this and it worked perfectly, and it makes much more sense to read. Exactly what I was looking for. Don't understand why it didn't occur to me to write it this way, but thanks for the idea!!
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