I added the following value
Local Traffic ›› iRules : Data Group List ›› rewrite_domains
and created the iRule
when HTTP_REQUEST {
Check to see if this is a new domain that needs to be silently re-written
set newURI [class match -value [HTTP::host] eq rewrite_domains]
if {$newURI ne ""} {
If it is, re-write the URI to the class matched value, and the host header to the old domain
HTTP::uri $newURI
HTTP::header replace "Host" "staging.site.com"
unset newURI
If it's not, check to see if it's someone accessing the old domain incorrectly
} elseif {[HTTP::host] eq "staging.site.com"} {
If it is someone accessing the old domain format, redirect them to the new domain
set redirDom [class match -value [HTTP::path] starts_with redirect_urls]
if {$redirDom ne ""} {
HTTP::redirect "https://$redirDom"
unset redirDom
}
}
}
no errors but I cannot make it to change the host when I type
http://test.irule.staging.site.com