Forum Discussion
Persist cookie serverID iRule
I want write an equivalent iRule for a Brocade load balancer Content Switching rule. Below is the CSW rule in Brocade. Basically the rule is to search for the Server ID in the Cookie header and persist the connection on that cookie header. Any equivalent iRule for this would be greatly appreciated.
csw-rule "sticky" header "cookie" search "ServerID="
csw-policy "vip"
match "sticky" persist offset 0 length 4 group-or-serverid
3 Replies
- JG
Cumulonimbus
Is this your complete config from Brocade? Or is this meant to be same as described in "
- DineshVM_265886
Altostratus
This is the full Brocade rule. I was able to build the iRule for the other CSW rules below. But I couldn't find an equivalent iRule for the one I mentioned in the actual question.
csw-rule "path" url equals "/"
csw-rule "sticky" header "cookie" search "ServerID="
csw-policy "vip"
match "path" redirect "*" "/xyz" ssl
match "sticky" persist offset 0 length 4 group-or-serverid
default forward 1
default rewrite insert-cookie "ServerID" " * " " * " 60I thought the iRule would look something like the below. I am not sure if the below one is right. But still working on putting together all the pieces.
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" }{
HTTP::redirect "https://[HTTP::host]/arch" }
elseif { [HTTP::header "cookie"] equals "ServerID=" } {
persist cookie
}
else {
pool default_pool
HTTP::cookie insert ServerID
} } - JG
Cumulonimbus
It seems to me that apart from the redirect, which you can set up a traffic policy for, a default cookie persistence profile will do the job, although a dedicated persistence profile with a unique cookie name is the recommended practice.
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