Forum Discussion
error code 503 redirect irule
- Jan 08, 2026
Injeyan, thanks for reaching out with your help. I wanted to share that we got this to work and I wanted to show how.
I applied this i-rule intially;
when HTTP_REQUEST {
if { [HTTP::uri] contains "/pssmetrics" }{
pool web-lb-dev-f5-ssl-pool2
} else {
pool web-lb-dev-f5-ssl-pool
}
}
That specifies I want that uri to go to pool2. In pool 2 I have server 1 and server 2. Pool (1) only has server 1. Within pool2, I have a custom healh monitor, and when you mentioned a health monitor, that got me thinking along that track. Within the custom monitor, the pool member with the active service for pssmetrics will get the traffic load balanced to it, the condition being anytime there is a 503 error code.
So as follows;
Send String:
GET /pssmetrics HTTP/1.1\r\nHost: webfrontendalias.domain.org\r\nConnection: Close\r\n\r\n
Receive String:
302
(No OK after this, the regex gets cranky)
Receive Disable Strng:
503
I thank you for this feedback. I need to include another detail. We have a situation where the pools will be up, but a specific application will be up on one pool and down on another. For example, https://webserver/pssmetrics may serve on pool 2, but not pool 1. If I get a 503 error code on pool 1 (the default), I want to failover to pool 2. I had an irule to look point to a pool based off uri. It won;t work for our purposes, but gives you an idea of how I want to redirect.
when HTTP_REQUEST {
if { [HTTP::uri] contains "/pssmetrics" }{
pool ta55-web-lb-dev-f5-ssl-pool2
} else {
pool ta55-web-lb-dev-f5-ssl-pool
}
}
- Injeyan_KostasJan 06, 2026
Nacreous
The approach is still the same
In your case you should just treat the specific path as unique application, meaning a dedicated pool with a specific health monitor. So the monitor is the one that will catch the 503 response beforehand.
If you wait to check the response to the clint it's already too late
when HTTP_REQUEST { if { [HTTP::uri] contains "/pssmetrics" }{ if { [active_members ta55-web-lb-dev-f5-ssl-pool2] > 0 } { pool ta55-web-lb-dev-f5-ssl-pool2 } else { pool ta55-web-lb-dev-f5-ssl-pool } } }
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