Forum Discussion
Michael_Yates
Jun 23, 2010Nimbostratus
Here is an example that you can apply to both your HTTP and HTTPS Virtual Servers.
If it is not HTTPS, then it will redirect to HTTPS.
If the [HTTP::host] does not match exactly or the [HTTP::uri] does not start with "/analytics" then it will do one of actions I have commented out. You could choose the best action for your situation and alter it to your needs.
when HTTP_REQUEST {
if { [TCP::local_port] != "443" } {
HTTP::redirect "https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
}
if { !([HTTP::host] equals "mysite.com") or !([HTTP::uri] starts_with "/analytics") } {
HTTP::respond 403
HTTP::redirect http://www.google.com
HTTP::respond 301 Location "http://www.google.com"
HTTP::respond 200 content "ErrorError No Access to: [HTTP::uri]"
drop
reject
}
}