Forum Discussion
ucgwebmaster_95
Nimbostratus
Jul 08, 2008Using Virtual Server for http to https for certain pages
I've tried many suggestions but to no avail. I have to Virtual servers. One on port 80 and one on port 443. I need to have traffic routed to the 443 virtual server for 4 aspx pages.
ex...
hoolio
Cirrostratus
Jul 08, 2008The host won't include the protocol. Also, the switch cases you have listed are exact. So a request with a query string like ..../login.aspx?action=something won't match. You can either add a * to the end to do a wildcard match against the URI, or you could just check the path (URI minus the query string). Also, you can add logging to help debug what's happening when a rule doesn't do what you expect. Make sure to comment out the logging once you're done testing.
when HTTP_REQUEST {
Check Host header value and the path (URI minus query string)
switch {[string tolower [HTTP::host][HTTP::path]]}{
"www.helpme.com/login.aspx" {
log local0. "[IP::client_addr]:[TCP::client_port]: matched login.aspx"
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
"www.helpme.com/myaccount.aspx" {
log local0. "[IP::client_addr]:[TCP::client_port]: matched myaccount.aspx"
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
"www.helpme.com/store/checkout.aspx" {
log local0. "[IP::client_addr]:[TCP::client_port]: matched checkout.aspx"
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
"www.helpme.com/register.aspx" {
log local0. "[IP::client_addr]:[TCP::client_port]: matched register.aspx"
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
default {
Take some default action?
log local0. "[IP::client_addr]:[TCP::client_port]: hit default case"
}
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
