Forum Discussion
iRule to redirect with an elseif statement
make sure you change the host string as well as the uri string to lower case Then you can do a proper check.
when HTTP_REQUEST {
chage host to all lower case
set $host [string tolower [HTTP::host]]
chage uri to all lower case
set Vuri [string tolower [HTTP::uri]]
if { $host equals "xxsupplier.xx.com" and $Vuri starts_with "/supplierguide" } { HTTP::redirect ";; } elseif { $host equals "xxsupplier.xx.com" and $Vuri equals "/" } { HTTP::redirect ";}
}
You will need an IRule for the HTTP to HTTPS traffic in the Port 80
when HTTP_REQUEST { set Vuri [ string tolower [HTTP::uri]] set Vheader [string tolower [HTTP::host]]
Make sure you change the header and the default redirection to match the new siteswitch $Vheader {
xxsupplier.xx.com {HTTP::redirect "https://[HTTP::host][HTTP::uri]"}
default { HTTP::redirect "https://xxsupplier.xx.com/" }
}
}
Then I will apply the following Irule to the HTTPS
when HTTP_REQUEST {
chage host to all lower caseset $host [string tolower [HTTP::host]]
chage uri to all lower caseset Vuri [string tolower [HTTP::uri]]
if { $host equals "xxsupplier.xx.com" and $Vuri starts_with "/supplierguide" } { HTTP::redirect ";; } elseif { $host equals "xxsupplier.xx.com" and $Vuri equals "/" } { HTTP::redirect ";}
}
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