default document and parameter based on host header
Hi I'm quite new to this, so please forgive me if this is something that you've seen before and have already answered.
I have an iRule that I wrote as more of a proof of concept. Basically I want to take connections to the default document and re-direct them with a parameter based on part of the host name. The following does what I want, but I'm looking for a better way to do it that can scale, to say 300 host names... From what I understand, this should be something that can be done using the scan command, but to be honest, it's a bit confusing for me.
when HTTP_REQUEST {
if { ([HTTP::host] equals "site1.domain.com") and ([HTTP::uri] equals "/") } {
HTTP::respond 301 Location "https://site1.domain.com/aaaa/bbbb/page.aspx?site=site1"
event disable
}
if { ([HTTP::host] equals "site2.domain.com") and ([HTTP::uri] equals "/") } {
HTTP::respond 301 Location "https://site2.domain.com/aaaa/bbbb/page.aspx?site=site2"
event disable
}
}
Any help you could offer would be appreciated
Thanks