Forum Discussion
URL to URI redirect irule required
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
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com