Forum Discussion

GTM_105231's avatar
GTM_105231
Icon for Nimbostratus rankNimbostratus
Dec 20, 2016

Restrict directory by IP

This first irule IP restriction works for "discard" but the second one does not do the redirect. Any help is appreciated.

 

when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/hello" and ![IP::addr [IP::client_addr] equals 152.140.0.0/16] } { discard } }

 

This does not work it gets a 404

 

when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/hello" and ![IP::addr [IP::client_addr] equals 152.140.0.0/16] } { HTTP::redirect "; } }

 

  • hi, you should add "; then it works well 🙂

    when HTTP_REQUEST {

    if { [string tolower [HTTP::uri]] starts_with "/haber" and ![IP::addr [IP::client_addr] equals 152.140.0.0/16] } {

    log local0. [HTTP::uri]

    HTTP::redirect "http://www.google.com"; 
    } 
    }