Forum Discussion
Scot_85536
Nimbostratus
Jul 29, 2009persistence change from the URI
Hi everyone,
I'm trying to change the persistence record at will from the URI. Basically, I need to be able to select the pool member that I'm going to in the URI for troubleshooting our custom app. Here's my irule so far. I posted the entire thing so that anyone else that finds it would be able to look at it also:
when HTTP_REQUEST {
sets the timer to return client to host URL
set sectime 60
Use the Host header value for the responses if it's set. If not, use the VIP address.
if {[string length [HTTP::host]]}{
set host [HTTP::host]
set errhost1 [HTTP::host]
set errhost2 [HTTP::host]
} else {
set host [IP::local_addr]
set errhost1 "site"
set errhost2 "the site"
}
Check if the URI is /maintenance
switch [HTTP::uri] {
"/maintenance" {
if { [active_members [LB::server pool] ] > 0 } {HTTP::redirect http://$host}
else { HTTP::respond 503 content "Maintenance page content=$sectime;url=http://$host>\
503 - Service temporarily unavailable
\
We are performing routine maintenance designed to improve your $errhost1 experience. \
We will have $errhost2 up again as soon as possible.
\
You will be automatically redirected to $errhost2 when it becomes available.
" "Content-Type" "text/html"
}
return
}
"/F5SERVERINFO" {
HTTP::respond 200 content "Pool:[LB::server pool]
Backend:[LB::server addr]
Port:[LB::server port]
Persist:[LB::persist]"
}
}
If the pool is down, redirect to the maintenance page
if { [active_members [LB::server pool] ] < 1 } {
HTTP::respond 200 content \
"
"
return
}
if { [HTTP::uri] contains "/F5SELECT" } {
set backendip [getfield [HTTP::uri] "&" 2]
persist uie $backendip [TCP::server_port]
HTTP::redirect "http://$host/F5SERVERINFO"
}
}
It is getting the IP assigned to the backendip variable correctly, and there's nothing in the logs. But the change in persistence doesn't work. Thanks for any help you can give me!
- The_Bhattman
Nimbostratus
Do you have a persist profile uie assigned to the VIP?
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