Prerak_Tiwari_3
Sep 29, 2017Nimbostratus
iRule to check the referer presense
I am trying to write a iRule to accommodate the following, If the Referer is “mydomain.example.com” then allow the request, if not then check if requested URI is the login page then allow, if not then show 500 error.
when HTTP_REQUEST {
switch -glob [HTTP::header "Referer"] {
"https://mydomain.example.com/*" {
HTTP::redirect [HTTP::header "Referer"]
}
"" {
if{[HTTP::uri] contains "/enter.do"}{
HTTP::redirect [HTTP::header "Referer"]
}
if{!([HTTP::uri] contains "/enter.do")}{
HTTP::respond 500 content ""
}
}
}
}
After applying this iRule I am always getting 500. Can someone help me write the correct iRule?