Forum Discussion
milo
Nimbostratus
Jul 06, 2009consolidate all http to https request under one virtual server
I would like to create one virtual server that uses a network segment to support all incoming http requests. The majority of my company's http traffic is redirected to https. I've come up with four di...
hoolio
Cirrostratus
Jul 07, 2009You could combine the rules into one with something like this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri] ] {
"/portal*" {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched URI /portal*, redirecting."
HTTP::redirect "https://secure.aaa.com/login.do"
return
}
"/b-portal*" {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched URI /b-portal*, redirecting."
HTTP::redirect "https://secure.bbb.com/login.do"
return
}
}
switch [string tolower [HTTP::host] ] {
www.aaa.com {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched host www.aaa.com, redirecting"
HTTP::redirect "https://www.aaa.com[HTTP::uri]"
return
}
www.bbb.com {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched host www.bbb.com, redirecting"
HTTP::redirect "https://www.bbb.com[HTTP::uri]"
return
}
www.ccc.com {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched www.ccc.com, using pool"
pool www.ccc.com
return
}
www.ddd.com {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched www.ddd.com, using pool"
pool www.ddd.com
return
}
}
log local0. "[IP::client_addr]:[TCP::client_port]: Matched , "
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
I added logging as I'm not 100% sure it matches your scenario. Anyhow, it should give you a start.
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