Forum Discussion
Les_Marstaeller
Nimbostratus
Dec 15, 2005Default pool when using IRules
Hi,
I am using an irule to direct http requests to one of two pools depending on the url.
eg. /123 goes to pool 123 and /456 goes to pool 456
In this case, do I need to set a default pool for the virtual server? If so, which one?
Thanks for any help,
Les
Canberra, Australia.
7 Replies
- Vincent_Power_9
Nimbostratus
You don't need a default pool in this situation, you could have your iRule redirect to a generic page if you wanted a "catch everything else" set-up.
Something like this would workwhen HTTP_REQUEST { if {[HTTP::uri] starts_with "/123"} { pool 123 } elseif {[HTTP::uri] starts_with "/456"} { pool 456 } else { HTTP::redirect http://some.other.address/ } } - unRuleY_95363Historic F5 AccountI will add merely one thing. The status of the virtual is derived from the status of the default pool. Without no default pool, your virtual server status will appear blue - or unknown. Other than that, there is no need for the default pool.
- Les_Marstaeller
Nimbostratus
Great, thanks very much for your help.
A merry & safe Christmas to everyone,
Les - Les_Marstaeller
Nimbostratus
One further question..
When I use "elseif" in the irule, it comes up with an error "Unknown Procedure". Any clues why this might be happening? We are using version 9.2
Thanks,
Les - Can you post the code that's generating the error?
Generally, you need to form your code like thisif { condition } { do_something } elseif { condition2 } { do_something_else } else { do_something_different }
If you put a space after a brace and then the elseif on a newline, it can cause validation errors.
-Joe - unRuleY_95363Historic F5 AccountYou may be bumping into the infamous space after the "} " when the "elseif" is on a new line problem. Tcl actually requires the "elseif" to be on the same line as the closing bracket, like Joe's example above. However, we extended Tcl to allow elseif to begin on a newline, but due to implementation details, it doesn't work if there is a trailing whitespace and thus thinks the "elseif" is an undefined command/procedure.
- Les_Marstaeller
Nimbostratus
Thanks once again for all your help. It is great to know that such knowledgable and helpful people here when I need it.
A happy holiday to you all.
Les
Canberra, Australia.
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
