Forum Discussion
Hannes_Rapp
Mar 25, 2015Nimbostratus
Good luck 😉
when HTTP_REQUEST {
switch [string tolower [HTTP::host][HTTP::path]] {
"abc.com/xyz" -
"abc.com/example1" -
"abc.com/example2" {
return
do nothing
}
default {
HTTP::respond 302 location "https://[HTTP::host][HTTP::uri]"
event disable
prevent a possibility of multiple redirect invocations (not needed, if it's your only iRule attached to the VS)
TCP::close
remove the TCP connection record from the connections table. Needed for some browsers, because if the connections record remains, the same redirect will not work the second time in a different tab.
}
}
}
- Hannes_RappMar 25, 2015NimbostratusIn this case you would want to use the priority function. Add the code "priority 10" (without quotes) to the beginning of the iRule (1st Line). This will ensure the HTTPS redirect iRule is processed before your secondary iRule. Might want to share your other iRule? We should make sure no important functionality loss will occur. Edit: - Also please share your exact request page when testing (e.g. http://abc.com/xyz) - Does the back-end server (pool member) serve more than one vHost via the same VS? I need to know if "abc.com" is the only host served, or are there more?