Forum Discussion
redirect to another pool when primary pool unavailable.
Hello, I want to use irule without success to redirect to another pool if members are down.
when HTTP_REQUEST {
sets the timer to return client to host URL
set stime 10
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]
} else {
set host [IP::local_addr]
}
Check if the URI is /maintenance
if { [active_members P_Prod] < 1 } {
HTTP::uri /
pool P_Sorry_Pool
}
}
When I disable members in prod pool, the P_Sorry_Pool seems not use . If I use the P_Sorry_Pool in the http_class define for this website, it's work fine . ( Just need flush ramcache when I want to return to prod pool ).
Any idea ?
Thanks
8 Replies
- Kevin_Stewart
Employee
The syntax looks correct. Do you have a monitor applied to the P_Prod pool?
- Kevin_Stewart
Employee
Okay, I misspoke earlier. You were disabling the prod pool members, which should have been enough to cause traffic to flow to the sorry pool regardless of a health monitor. In any case, the syntax still looks correct. Can you modify it as follows and report what it does:
when HTTP_REQUEST { if { [active_members [LB::server pool]] < 1 } { pool P_Sorry_Pool HTTP::uri "/" } } - stephane_dobbel
Nimbostratus
Nothing change . Browser detect a bad redirection .
For information : ltm profile httpclass /Convergence/httpclass_Prod { app-service none asm enabled defaults-from /Common/httpclass hosts { glob:mysite.com } pool /Convergence/P_Prod redirect none }
The pool server Sorry is a basic Apache server .
- Kevin_Stewart
Employee
So just curious, but why do you have this http class applied if you have the pool defined in the VIP? Can I assume your intention here is to direct traffic to the prod pool if the host matches "mysite.com"?
Also check /var/log/ltm for any errors. An iRule error will usually manifest as a bad response in the browser, and you should see something in the log.
Worst case the pool selection could be working but the sorry server is sending something the browser doesn't understand. Performing a client side capture to see if you you're actually seeing HTTP payload from the sorry server might help.
- stephane_dobbel
Nimbostratus
The pool is not define in the VIP but in the Http class. /var/log/ltm don't give informations... 😕 just when there is a wrong syntax in the irule.
ltm virtual /Convergence/VS_Convergence_Prod { destination /Convergence/X.X.X.X:80 http-class { /Convergence/httpclass_Convergence_Prod } ip-protocol tcp mask 255.255.255.255 persist { /Convergence/cookie-Convergence { default yes } } profiles { /Common/http-x-forwarded-for { } /Common/tcp-lan-optimized { context serverside } /Common/tcp-wan-optimized { context clientside } /Convergence/analytics-full { } } rules { /Convergence/rule_Convergence_Prod } snat automap translate-address enabled translate-port enabled vlans-disabled }I will do a capture. Thank you
- stephane_dobbel
Nimbostratus
no trace in in the ltm log file.
- Kevin_Stewart
Employee
I don't have a pre-11.4 system in front of me to test this with an HTTP class, but given that your class is pointing one host to one pool, why not just assign the pool to the VIP?
- stephane_dobbel
Nimbostratus
Because I use the http_class to link the asm and URIs. do you think it will be a problem ? I can try with a VIP -> pool without http_class.
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
