cancel
Showing results for 
Search instead for 
Did you mean: 

Help iRule

Choi
Nimbostratus
Nimbostratus

Hi,

 

iRule is not working. Please help me.

 

Redirect action does not work.

 

Data Group Lists

EX)

Deny - Address

1.1.1.0/24

 

Accept - Address

2.2.2.0/24

 

Allow - string

test/ealogin

test/first/eamain

--------------------------------------------------------------------

when HTTP_REQUEST {

if {[HTTP::host] equals "vdi.lost.com" && [HTTP::path} equals "/" && [class match [IP::client_addr] equals Deny]} {

HTTP::respond 200 content [ifile get notice] "Content-type" "text/html"

}

elseif {(HTTP::host] equals "vdi.lost.com" && [HTTP::path] equals "/") && not [class match [HTTP::uri] equals Allow] && [class match [IP::client_addr] equals Accept]}{

HTTP::redirect "https://vdi.lost.com/test/first/eamain"

}

else{

pool test_pool

}

}

 

 

--------------------------------------------------------------------

 

condition.1

 I want to print a blocking page for the IP included in the datagroup called deny in the domain called vdi.lost.com

 

condition.2

In the domain vdi.lost.com the IP included in the datagroup called Accept is redirected to https://vdi.lost.com/test/first/eamain

(But only if it's not the uri included in the Allow.)

EX) vdi.lost.com/adfhadh -> vdi.lost.com/test/first/eamain redirect

EX) vdi.lost.com/sfgns -> vdi.lost.com/test/first/eamain redirect

EX) vdi.lost.com/ealogin -> no Redirect

EX) vdi.lost.com/test/first/eamain -> no Redirect

 

condition.3

All other IP are default

 

Please help me

 

The interpretation may be strange using a translator.

 

Thank you!!!

 

 

 

1 REPLY 1

Hi Choi,

 

Can you remove [HTTP::path] equals "/" from iRule, and try?

when HTTP_REQUEST { if { [HTTP::host] equals "vdi.lost.com" && [class match [IP::client_addr] equals Deny] } { HTTP::respond 200 content [ifile get notice] "Content-type" "text/html" } elseif { [HTTP::host] equals "vdi.lost.com" && [class match [IP::client_addr] equals Accept] && not [class match [HTTP::uri] equals Allow] } { HTTP::redirect "https://vdi.lost.com/test/first/eamain" } else { pool test_pool } }

Strings in the datagroup named "Allow" must start with "/".