Forum Discussion
Tony_Bourke_935
Nimbostratus
Sep 10, 2010iRules HTTP_RESPONSE based on Pool?
Is there a way to do switch or if statements based on the pool the response came from?
For example:
I'm dividing up traffic into two pools based on the URI. Pool "http" and pool "gopher".
I need to rewrite http:// to https:// if the response was sent to pool "http", and rewrite http:// to gopher:// if it came from pool "gopher".
- Chris_Miller
Altostratus
Here's the HTTP_RESPONSE wiki which also contains available commands: - Tony_Bourke_935
Nimbostratus
Hi Chris, - Chris_Miller
Altostratus
I suppose you could set a variable in the LB_SELECTED event that you check for in your response event... - L4L7_53191
Nimbostratus
Hi Tony: would it be possible to simply set a variable in your HTTP_REQUEST event that you reference on HTTP_RESPONSE? For example, you've already made a decision to send some traffic to one pool or the other based on uri, so you should be able to do this.when HTTP_REQUEST { if {HTTP::uri equals '/foo'} { set selected 'gopher' pool gopher } else { set selected 'http' pool http } } when HTTP_RESPONSE { log local0. "This response is coming from pool $selected..." }
- L4L7_53191
Nimbostratus
By the way you could also use LB::server in the request event to set the pool name of the node, if I recall...so it would look something like:set selected [LB::server pool]
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