Forum Discussion
hooleylist
Feb 03, 2010Cirrostratus
The syntax error is in the IP::addr closing braces and the unescaped new line between the IP::addr commands. Also, you can check the client IP in CLIENT_ACCEPTED and redirect in HTTP_REQUEST to save checking the client IP on every request:
when CLIENT_ACCEPTED {
Check if the client IP is in the two internal ranges
if { [IP::addr [IP::client_addr] equals 10.0.0.0/8] or \
[IP::addr [IP::client_addr] equals 172.16.0.0/16]} {
Dont redirect the client
set redirect 0
} else {
set redirect 1
}
}
when HTTP_REQUEST {
if {$redirect}{
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
Aaron