Sunny_81459
Sep 16, 2008Nimbostratus
HTTP redirect
I need urgent help can some iRle expert write for me?
Brief:
currently, if i request https://test.com/groupabc/aarp.jsp is getting redirected to https://test.com/abc/private/xyz.do but as per the code https://test.com/groupabc/aarp.jsp as header referer enabled.
I would like setup redirect, if uri eq "https://test.com/abc/private/xyz.do" and http_refere equals to NULL then it should redirect to https://test.com/groupabc/aarp.jsp
I have configured the following irule but not working.
===============
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/abc/private/xyz.do" and
( $refer_host ne "" ) } {
HTTP::redirect "https://test.com/groupabc/aarp.jsp"
}
else {
pool test.com
}
}
===============
Following is the sameple rule witch i referred.
====================
class allowed_referers {
"www.companya.com"
"www.companyb.com"
"www.companyc.com"
}
To disallow empty referers remove the ' and $refer_host ne "" ' check
To drop the request without redirecting to a custom image, replace
the HTTP::respond with 'reject'.
when HTTP_REQUEST {
set refer_host [string tolower [URI::host [HTTP::header Referer]]]
if { ( [matchclass [HTTP::path] ends_with $::images] ) and
( $refer_host ne "" ) and
( not [matchclass $refer_host contains $::allowed_referers] ) } {
log local0.NOTICE "hotlink detected from host: $refer_host"
HTTP::respond 301 "Location" "http://[HTTP::host]/hotlink.gif"
}
}
==============