Forum Discussion
JB_106099
Apr 02, 2012Nimbostratus
Conditional Irule
I am new to irules and I need some assistance on writing an irule that will allow my local subnets to a uri that contains a specific string but will drop all external connections and also send a response code 403 to these dropped connections.
Data group defined "internal_subnets"
string in uri "?arch" on which rule is to apply.
Any assiatance would be greatly appreaciated.
JB
- when HTTP_REQUEST {
- Hi Sashi,
- ok, u cant use class on v9. use matchclass instead
- Hi JB,
v10.x.xwhen HTTP_REQUEST { if { [HTTP::query] contains "arch" } { if { !([class match [IP::client_addr] equals internal_subnets]) } { HTTP::respond 403 content "Forbidden" } } } v9.x.xwhen HTTP_REQUEST {if { [HTTP::query] contains "arch" } {if { !([matchclass [IP::client_addr] equals $::internal_subnets]) } {HTTP::respond 403 content "Forbidden"}}}
- Thank You, I will test both of these options out tonight and update tomorrow.
- Sashi and Michael,