Forum Discussion
f5 Hiccup with new iRule
I will do my best to detail the steps that have landed me in my current situation.
1. Had Virtual server with specified pool (pool1) containing 3 nodes (node1,node2,node)
2. Removed node3 from pool1 removed node3
3. Created new pool image1
4. Create new node (image1) this node has same ip as node3 had but a different service port
5. Added node to image1 pool
I then created the following rule:
elseif { [HTTP::uri] contains "/image/" } {
log local0. "Using: image1 pool"
pool image1
}
When I visit my sites index page I get a normal response, however when I try to navigate anywhere
on the site or hit refresh I get a 404 response that can only becoming from my old node3 on its new
service port. I have added a logging rule to confirm my suspicions (it confirms my theory).
when HTTP_RESPONSE {
log local0. "Responding node: [IP::server_addr]:[TCP::server_port]"
}
So I am confused as to how to resolve my current issue without take the following steps.
1. Delete all virtual servers and pools through admin console and re-add.
2. Drive to the colocation and hit reset to default button and re-add.
Neither of these options seems appealing and I am hoping there is another method.
Please assist.
6 Replies
- Michael_Yates
Nimbostratus
Can you post the entire iRule and the members of each pool? - richard_77048
Nimbostratus
I see that you have an "elseif" there in your rule. Could you be matching in an earlier "if" statement in your rule? In a series of if elseif elseif... else statements, you will bail once you get a match. - ddurst_21358
Nimbostratus
when HTTP_REQUEST {
log local0. "Incoming Request:[IP::client_addr] Requesting: [HTTP::uri]"
if { [HTTP::uri] starts_with "/mrocache/mrosupply_data.xml" } {
log local0. "Using: mrocache pool"
pool mrocache
}
elseif { [HTTP::uri] contains "/image/" } {
log local0. "Using: mroimage pool"
pool mroimage
}
}
when HTTP_RESPONSE {
log local0. "Responding node: [IP::server_addr]:[TCP::server_port]"
}
mroimage pool:
10.10.1.3:80
mrocache pool:
10.10.5.1:8080
mrosupply-pool:
10.10.1.1:8080
10.10.1.2:8080 - richard_77048
Nimbostratus
So "mrosupply-pool" is the default pool configured for this virtual server? If so, do you get the same behavior if you alter your rule like this?when HTTP_REQUEST { log local0. "Incoming Request:[IP::client_addr] Requesting: [HTTP::uri]" if { [HTTP::uri] starts_with "/mrocache/mrosupply_data.xml" } { log local0. "Using: mrocache pool" pool mrocache } elseif { [HTTP::uri] contains "/image/" } { log local0. "Using: mroimage pool" pool mroimage } else { log local0. "Using: mrosupply pool" pool mrosupply-pool } } - ddurst_21358
Nimbostratus
This worked, however I am curious as to why it worked. Can you please explain so I do not make a similar mistake in the future. - richard_77048
Nimbostratus
Here is an article which explains what you saw:
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/130/iRules-101--05--Selecting-Pools-Pool-Members-and-Nodes.aspx
The short version is that you matched on "/image/" and your next request didn't match on "/mrocache/mrosupply_data.xml". Your rule without that final else statement used the last pool it had selected, the mroimage pool. Adding a final "else" catches anything that didn't match earlier in your rule and ensures that mrosupply-pool is selected if nothing else matches.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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