mlamutt_62697
Feb 03, 2010Nimbostratus
Redirect HTTP to HTTPS with IP exclusions
I am writing an iRule to allow HTTP access for a select set of IPs while forcing all other traffic to https. This is what I have come up with, but it is not working. Apologies in advance, as this is my first attempt at creating a new rule.
when HTTP_REQUEST {
if { not ([IP::addr [IP::client_addr]] equals 10.0.0.0/8) or
not ([IP::addr [IP::client_addr]] equals 172.16.0.0/16)
} {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
}
The error I am getting is:
01070151:3: Rule [HTTPRedirectWSODExluded] error: line 2: [parse error: PARSE syntax 73 {syntax error in expression " not ([IP::addr [IP::client_addr]] equals 10.0.0.0/8) or ...": looking for close parenthesis}] [{ not ([IP::addr [IP::client_addr]] equals 10.0.0.0/8) or not ([IP::addr [IP::client_addr]] equals 172.16.0.0/16) }]
Any help would be appreciated.