Forum Discussion

Carpenteiro_661's avatar
Carpenteiro_661
Icon for Nimbostratus rankNimbostratus
Nov 30, 2013

Can you please provide an example in irules where I reference the HTTP_REFERRER to block access from certain sites?

Typically HTTP_REFERRER is not past on public sites, but I have some non production websites where I can add this header and I want to ensure when going to production site if I get a referrer from non-production website it is blocked.

 

1 Reply

  • Hi Carpenteiro, HTTP referer is not an EVENT in iRule language, because it is an HTTP Header in HTTP Protocol. when we write HTTP_XYZ in iRule, it is the name of an event 😉

    So, taking in account it is an Header, then what you are looking for is mostly something like the following:

    when HTTP_REQUEST {
         if {[HTTP::header "Referer"] starts_with "http://myprivate_site.intra"} {
                you can forward the trafic to the final destination, or load balance it with the command "pool" XYZ_Pool
               forward
    }
         else {
               reject
               you can also send an HTTP Redirect if you want.
    }