wcm
May 04, 2021Nimbostratus
iRule to add ".org" to host and redirect to HTTPS
Hello,
I'm trying to write an irule that will take an HTTP request like "http://example" and rewrite it with ".org" or some other suffix.
It seems stupid that this is even required, but it is a request that came in and I would like to be able to deliver. Here is what I have so far:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "example" } {
HTTP::respond 301 Location "https://example.org"
}
}
The rewrite seems to be working; it takes http://example and writes it to example.org but it doesn't add HTTPS, so the page fails to load.
What would be the best way to take an HTTP request that is missing the .org, .com etc and append it properly, while also redirecting to HTTPS?
Thanks