Reputation: 797
I am using NGINX and one of my site is suffering from referrer spam.
I followed the NGINX wiki, and I found this but after using the code, it is blocking my site. Is there any solution? I have also tried using this code but it didn't worked
if ($http_referer ~ "spamdomain1\.com|spamdomain2\.com|spamdomain3\.com") {
return 444;
}
I want to block the domain from where I am getting referrer hits.
Upvotes: 1
Views: 1063
Reputation: 597
We began working on our internal tool ReferrerSpamBot that helps adding the dynamic filters to your Google Analytics account and also we want to develop a module for nginx in the future. Check out the project on GitHub
Upvotes: 0
Reputation: 10314
I would use a map.
# at the http level:
map $http_referer $drop_referer {
default 0;
~spamdomain1\.com 1;
~spamdomain2\.com 1;
~spamdomain3\.com 1;
# ... (put these in an included file if there are many)
}
# in your server stanza:
if ($drop_referer) {
return 444;
}
Upvotes: 1