Forum Discussion
Tom_Bell_15050
Nimbostratus
Jun 10, 2010Irule Redirect to one pool if 404 received from the first.
Howdy Guys,
My business has presented me with the following issue. They want traffic to a particular URL served from a static pool and if the file isn't present, we detect the 404 and redirect the request to another pool which serve's the file.
I've written the following rule and am yet to test it .. however I'm rather sure it's not going to perform as a I wish. If anyone has a suggestion I'd love to here it.
when HTTP_REQUEST {
set uri [HTTP::uri]
if {$url starts_with "/static/"} {
pool stage-static
}
}
when HTTP_RESPONSE {
set status [HTTP::status]
if {$status eq "404" and $url starts_with "/static/"} {
clone pool stage-web
}
}
Thanks
Tom
- Michael_Yates
Nimbostratus
How about something like this:when HTTP_REQUEST { if { [HTTP::uri] starts_with "/static" } { set uri [HTTP::uri] pool stage-static } } when HTTP_RESPONSE { if { [HTTP::status] == 404 and $uri contains "/static" } { HTTP::redirect "/" } }
- hoolio
Cirrostratus
Here's a related example for retrying the HTTP request after a specific status code is seen:
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