https to https with VIP as the host

Redirect all traffic coming to New IP(12.29.100.200) or blah.com or developer.blah.com to https://www.blah.comhttps://www.blah.com with carry forwarding the folder/parameters.

Some Examples:

a) http://12.29.100.200/blue~~http://12.29.100.200/blue~~ => https://www.blah.com/blue~~https://www.blah.com/blue~~

b) https://12.29.100.200/blue~~https://12.29.100.200/blue~~ => https://www.blah.com/blue~~https://www.blah.com/blue~~

c) http://12.29.100.200/blue?abc=123~~http://12.29.100.200/blue?abc=123~~ => https://www.blah.com/blue?abc=123~~https://www.blah.com/blue?abc=123~~

d) https://12.29.100.200/blue?abc=123~~https://12.29.100.200/blue?abc=123~~ => https://www.blah.com/blue?abc=123~~https://www.blah.com/blue?abc=123~~

The below does not work:

when HTTP_REQUEST {

HTTP::redirect “https://www.Blahcom[HTTP::uri]”

}

when HTTP_REQUEST {

HTTP::respond 301 Location ““https://www.blah.com” [HTTP::host] : 1][HTTP::uri]”

}

when HTTP_REQUEST { if {[string tolower [HTTP::host]] ne “www.blah.com”} { HTTP::redirect “https://www.blah.com [HTTP::uri]” } }

when HTTP_REQUEST {

if {[HTTP::host] equals “12.29.100.200”} {

if { ([HTTP::uri] contains “/*”) }{

HTTP::redirect “https://www.blah.com]”}

}

if {[HTTP::host] equals “blah.com”}{

if { ([HTTP::uri] contains “/*”) }{

HTTP::redirect “https://www.blah.com]”}

}

if {[HTTP::host] equals “dev.blah.com”}{

if { ([HTTP::uri] contains “/*”) }{

HTTP::redirect “https://www.blah.com]”}

}

As discussed, we do not have any server pool mapped to the VIP: 12.29.100.200 . We just want to have irule in place which will redirect traffic http or https coming to 12.29.100.200 or blah.com or developer.blah.com to https://www.blah.com/~~[https://www.blah.com](https://www.blah.com/)~~ with carry forwarding the folder/parameters. We are testing to the VIP!

Can someone please help with this irule!

Hi,

If you want to make sure all requests to the pool are done with a hostname of www.blah.com, you could use something like this:

when HTTP_REQUEST {

if {[string tolower [HTTP::host]] ne "www.blah.com"}{
HTTP::redirect "http://www.blah.com[HTTP::uri]"
}
}

Aaron

This is just a simple webpage redirect. So.

when HTTP_REQUEST {

HTTP::redirect"https://www.blah.com" [HTTP::host] “:” 1][HTTP::uri]

}

could work for all of what I had instead of each host named out.