Rewrite http_referer

n3uro5i5 nginx-forum at nginx.us
Tue Mar 31 01:16:00 MSD 2009


Hi, i want to catch request from a determinate referer website and redirect it to my root path.

I try this:

 if ($http_referer ~* "my_referer.com"){
   rewrite (.*) / redirect;
  }

But when i did't firefox say me that the request is in a neverending loop. 
So i need to rewrite the request referer header before redirect it.

I tried it like this:

 if ($http_referer ~* "my_referer.com"){
   rewrite (.*) / reset_header redirect;
  }

location /reset_header{
  proxy_set_header Referer "";
  rewrite (.*) / redirect;
}

But i don't get any results.

Any suggestion? Thanxs!!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,651,651#msg-651






More information about the nginx mailing list