Forum Discussion
Hello Chethan.
Below one example of using URI replacement (first statement) and redirect (second statement).
when HTTP_REQUEST {
if { [HTTP::host] contains "www.example.fr" } {
HTTP::uri /ckpartner
} elseif { [IP::addr [IP::client_addr] equals 10.10.10.0/24] } {
HTTP::redirect "http://www.example.fr/ckpartner/"
}
}
Note that in the redirect command you should use the adequate scheme (http:// or https://)
Please, don't forget to mark this answer as "the best" if it was helpful.
KR,
Dario.
Thanks Dario ,
I tested first irule , it did not work for us .
We want all the request comming to www.example.fr from specific source 10.10.10.1 to get redirected to www.example.fr/ckpartner/ and this should be logged .
Can you please check if the below Irule we can achieve this ?
when HTTP_REQUEST {
if { ([IP::addr [IP::client_addr] equals 10.10.10.1]) && ([HTTP::host] starts_with "www.example.fr") } {
log local0.
set newUri [string map {"/" "ckpartner/"} [HTTP::uri]]
HTTP::uri $newUri
}
}