Reputation: 15092
when using nginx as a simple webserver (no reverse proxy magic, not even cgi, etc...) is it possible to set a list of VALID referrers and do something like :
if ( referrer not in list of VALID referrers ) {
log this referrer
}
is something of this sort possible using a standard nginx source OR any additional modules/extensions?
as i understand this could possibly be slightly involved, no need for a full conf write up... pointing me at the correct conf directives will suffice :)
thanks!
Upvotes: 3
Views: 1733
Reputation: 13221
http {
map $http_referrer $log_ref {
default 0;
http://referrer1/path 1;
~^http://referrer2/ 1;
}
server {
location / {
if ($log_ref) {
access_log ....
}
}
}
}
Nginx version 0.9.6+ supports regular expressions in map
. Marker ~
serves to denote them.
Upvotes: 3