Forum Discussion
smp_86112
Cirrostratus
Jun 24, 2010Optimizing If statement conditions
I see this examples like this all over the place:
when HTTP_REQUEST {
if { [HTTP::host] equals "www.myhost.com" and [HTTP::uri] equals "/myuri" } {
HTTP::redirect https://[HTTP::host][HTTP::...
Jun 24, 2010
Another optimization technique that is often forgotten is to omit all code that always succeeds. If, for instance, the host on the virtual is always www.myhost.com (the virtual isn't multi-hosting domains), then leaving that check out completely wouldn't be a bad idea. In this case, it would be faster to build multiple iRules to run with different virtuals, than building a single iRule you could apply to mutliple virtuals. It would be more to maintain, but it would be faster.
Good point for Jason on the "string tolower" checks. That is almost always done on the URI but isn't needed on the host header.
-Joe
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
