Forum Discussion
jokragly
Nimbostratus
Jul 22, 2016iRule for sorry page with pool and path
So I have an iRule that identifies if the LB server pool is equal to 0 then call a different pool which is the server hosting the Sorry Page. The issue is the Sorry page is not at the root of this p...
Jul 22, 2016
Hi again!
Here's some comments:
when LB_FAILED {
LB failed is triggered when the load balancer
is unable to choose a member for the connection (no available
members, or too many retries due to server connection issues
Set the variable failed to 1 so we can check it later in the response
set failed 1
Rewrite the uri to whatever you want it to be.
The client would still see whatever they had from before
HTTP::uri "/maintenance/maintenance.html"
Select the pool you want to serve the maintenance page
pool mov_maintenance_page
}
}
when HTTP_RESPONSE {
Check if the LB failed event has been triggered by checking if
the variable failed exists and is set to 1
if { [info exists failed] && $failed == 1 } {
Close the connection to make sure that the user makes a new connection
HTTP::close
}
}
`
The problem with this setup, which I might mention too, is that you would be unable to send any pictures with the sorry page, unless you encode them with base64 within the html content OR use a CDN to deliver them.
Reason:
ol
Instead you might want to qualify incoming requests for the sorry page content directory before rewriting the uri:
` when LB_FAILED {
LB failed is triggered when the load balancer
is unable to choose a member for the connection (no available
members, or too many retries due to server connection issues
Set the variable failed to 1 so we can check it later in the response
set failed 1
If the client does not request resources in the maintenance
folder, then rewrite the uri. Otherwise, let it pass through as the
content reqests belongs to the maintenance page
if { !([HTTP::uri starts_with "/mov") } {
HTTP::uri "/mov"
}
Select the pool you want to serve the maintenance page
pool mov_maintenance_page
}
}
when HTTP_RESPONSE {
Check if the LB failed event has been triggered by checking if
the variable failed exists and is set to 1
if { [info exists failed] && $failed == 1 } {
Close the connection to make sure that the user makes a new connection
HTTP::close
}
}
From a design perspective I would consider delivering the sorry page content directly from the F5 though using HTTP::respond and content from the CDN, because when there's a server side problem, there's also a risk that your sorry pool members is affected too.
/PatrikHelp 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