Forum Discussion
eirikn
Mar 15, 2016Nimbostratus
Individual Apology page with DataGroup
Hey,
I'm trying to present many different apology pages based on the incoming host header.
I have about 100 different hosts, and all hosts would need a different 301 redirect if the pool is unava...
Michael_Jenkins
Mar 15, 2016Cirrostratus
First thing I see is that in your data group, the key value is probably never going to be triggered that way. You'll need it to be
mysite.com
or www.mysite.com
, which is what the HTTP::host
value will be.
Secondly, I'd change the event up a little bit. I assume you're using
event disable
so no other iRules will run on the connection. That command will disable the even for future requests on the same connection as well, so you may want to do one of 2 things. Either close the connection and force a new one, or re-enable the event before the response goes out.
Option 1: Close the connection
when HTTP_REQUEST {
set artifactid [class match -value [string tolower [HTTP::host]] contains my_apology_dg ]
if {( $artifactid ne "") and ([active_members my_web_pool] < 1) }{
HTTP::respond 302 Location $artifactid "Connection" "Close"
Disable all other iRules for this connections
event disable all
}
}
Option 2: Re-Enable the event
when HTTP_REQUEST {
set artifactid [class match -value [string tolower [HTTP::host]] contains my_apology_dg ]
if {( $artifactid ne "") and ([active_members my_web_pool] < 1) }{
HTTP::redirect $artifactid
event HTTP_REQUEST disable
}
}
when HTTP_RESPONSE_RELEASE {
event HTTP_REQUEST enable
}
If you wanna see the event order on a connection, here's an article describing it, to get an idea of the flow.
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