redirect based on source ip subnet to another website.

hi all, I am working with irule and it would work find when HTTP::redirect “http://www.google.com[HTTP::uri]” with reject, however I am not even able to save it the way it is below.

when CLIENT_ACCEPTED { if { [class match [IP::client_addr] equals DataGroupList] } { HTTP::redirect “http://www.google.com[HTTP::uri]” } }

can anyone tell me what am I doing wrong? or better, tell me what to do so that this irule would work?

all comments and replies are much appreciated.

MJ

Hi,

Please try with when HTTP_REQUEST instead of when CLIENT_ACCEPTED because the latter fires as soon as the 3-way handshake is finished and before the HTTP GET request. And make sure you have an http profile assigned to the VS

when HTTP_REQUEST {
    if { [class match [IP::client_addr] equals DataGroupList] } {
        HTTP::redirect "http://www.google.com[HTTP::uri]"
    }
}

good morning Amine,

This worked perfectly. I just had to remove the [HTTP::uri] other than that, it fixed the problem.

Thank you very much. MJ

Glad it worked for you. Would you mind marking the answer as correct?