Forum Discussion

KD_48848's avatar
KD_48848
Icon for Nimbostratus rankNimbostratus
Oct 02, 2008

http referer usage in iRule

Hi,

 

 

Need a configuration sample where we can compare that if the http referrer for a particular site is NULL then redirect to a particular location.

 

 

The link to be compared for http referrer and the link to which it should be redirected has the same http host but different http URI.

 

 

eg: If http referrer is Null for "www.abc.com/xyz" then redirect to "www.abc.com/pqr".

 

 

How do we accomplish this ?

 

 

Thanks in advance for your help.

 

 

 

 

Thanks,

 

KD.
  • This should do it for you (or something similar).

    when HTTP_REQUEST { 
       if { ![HTTP::header exists "Referer"] } { 
         switch -glob [HTTP::uri] { 
           "/xyz*" { 
             HTTP::redirect "http://www.abc.com/pqr" 
           } 
           "/abc*" { 
             HTTP::redirect "http://www.abc.com/def" 
           } 
         } 
       } 
     }

    Notice Referer is spelled wrong in the RFC so don't type in "Referrer" or it will never pass.

    -Joe