Forum Discussion
d__383820
Nimbostratus
Feb 15, 2019URL Redirect Switch not detecting on host for base domain
I am wanting to redirect certain hosts to HTTPS for offload. my iRule is working for hosts within the domain (e.g. ) but not for base domain host (e.g. domain.com).
The below iRule is working fo...
DennisJann
Nimbostratus
Feb 15, 2019I had to remove the ";" after ";, but otherwise your iRule syntax works as expected for me.
You could try using
curl
to test against the IP address of your VIP to see if you get the desired behavior.
curl -iv -H "Host: domain.com" http:///
If it works, compare against the output of:
curl -iv http://domain.com/
While your iRule syntax isn't wrong, it could be re-written as:
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"domain.com" -
"www.domain.com" -
"uat.domain.com" {
HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]"
}
default {
pool default_pool
}
}
}
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