Forum Discussion
Ian_Stewart_390
Nimbostratus
Oct 14, 2005iRules, URL Routing and Cookie Persistance
Hi Everyone,
We have a BigIP 1500, configured with several virtual servers and pools. We use an iRule to make routing decisions to direct traffic to the correct pool based on request URL, since the site is distributed across several pools.
The iRule for one of the virtual servers is as follows. It has a default pool of webnode3_pool.
when CLIENT_ACCEPTED {
set defpool [LB::server pool]
}
when HTTP_REQUEST {
set request_uri [string tolower [HTTP::uri]]
set request_host [string tolower [HTTP::host]]
if { $request_uri contains "/aspnet_client/" } {
pool webnode_pool
}
elseif { $request_uri contains "/ig_common/" } {
pool webnode_pool
}
elseif { $request_uri contains "/cpm/" } {
pool cpmweb_pool
}
elseif { $request_uri contains "/agentrequest/" } {
pool webnode_pool
}
elseif { $request_uri contains "/agents/" } {
pool webnode_pool
}
elseif { $request_uri contains "/home/" } {
pool webnode_pool
}
else {
pool $defpool
}
}
The URL routing works fine. The virtual server is configured to use cookie-insert persistance. If I look at my cookies when I browse the site, I can see BigIP cookies. My concern is that in the administration webpage, under persistance records, every record is showing SOURCE ADDRESS AFFINITY. We recently tried to run a load balancing test, (one machine that makes multiple connections to the site to generate a load), and the BigIP failed to load balance any of the requests.
Does using the iRule not allow the default persistance method defined on the virtual server to take effect? Is there something else I'm missing here -- why isn't cookie-insert persistance working?
Thanks in advance,
Ian
22 Replies
- Brian_Gupta_115
Nimbostratus
Could you please post the configuration for this virtual?
Thanks,
Brian
P.S. - Log in via the CLI as root (ssh/telnet) and type 'more bigip.conf' - Ian_Stewart_390
Nimbostratus
Gladly.
virtual www.mywebsite.com_HTTPS {
destination 63.104.68.144:https
snat automap
fallback persist source_addr
ip protocol tcp
profile http_features oneconnect tcp www.mywebsite.com
persist cookie_persistant_services
pool webnode3_pool
rule URL_Routing
vlans external enable
}
profile persist cookie_persistant_services {
defaults from cookie
mode cookie
across services enable
}
profile http http_features {
defaults from http
oneconnect transformations disable
compress selective
compress content type include none
compress content type exclude none
compress vary header disable
compress http 1.0 enable
compress gzip level 4
} - JRahm
Admin
I don't think the LB::server is available in the CLIENT_ACCEPTED event, so nothing is getting set, and thus, no default persistence. - Ian_Stewart_390
Nimbostratus
To test your idea, I put a log line just after the set defpool command.
My local traffic log filled with lines like:
Rule URL_Routing : Default pool is: webnode3_pool
So it would seem that the default pool was being set correctly.
I was thinking:
What I want to happen is that should someone request http://www.mywebsite.com/cpm/, I want them to be processed by this rule, and then persisted to whatever node in the CPM_Pool that they get load balanced on to. We want our website to appear as one site, even though different URL paths are serviced by different web applications, running on different pools.
The way this is written though, I'm wondering if it's possible that for each request, this iRule runs again, and they have the danger of being re-load balanced. If they were, the site would be quite broken though, we'd know right away. Perhaps the F5 detected this and is using Source Address Affinity? Does any of that sound reasonable? If so, what alternative solution might you suggest?
-Ian - Brian_Gupta_115
Nimbostratus
If this is in testing, can you remove the fallback persistence profile? (Source IP)
Thanks,
Brian
P.S. - We'll put it back once it is working correctly... - Ian_Stewart_390
Nimbostratus
I can't remove the fallback persistance profile right now -- this is a production enviornment. Possibly I could do it late tonight -- what were you looking to see? If it would stop persisting at all after that was turned off? - Brian_Gupta_115
Nimbostratus
Right. I've never used a fallback persistence profile, and I wanted to take it out of the equation.
-Brian - Brian_Gupta_115
Nimbostratus
One other thing, I think you need the following in your persistence profile... "cookie mode insert"
-Brian
P.S. - I think this is the missing piece. (It should work now).
P.S.S. - If you need verification, you will need to open a support case. - Ian_Stewart_390
Nimbostratus
cookie mode insert is in the parent profile "cookie", and I shouldn't have to respecify it. No harm in doing so though, so I've done that. I have not seen any change yet though. =/
-Ian - Brian_Gupta_115
Nimbostratus
What does "across services enable" do, and why do you have it set?
-Brian
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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