我已经写了一个基本的http Referer重定向器,看起来像这样:
if ($http_referer ~* (google|yahoo|bing|duckduckgo)) { return 301 https://altavista.com; }
我的目标是这样的
if ($http_referer ~* (google|yahoo|bing|duckduckgo)) {
add $x-forwarded-for bad_ips.txt; <-- this line is the question (x-forwarded-for because it's behind cloudflare)
return 301 https://altavista.com;
}
if ($bad_ip) {
return 301 https://altavista.com;
}
有什么办法吗?从本质上来说,目标是如果您从黑名单上的网站获得推荐,我想将您的IP添加到重定向列表中。
注意:这不必纯粹在nginx中完成;只要可以免费使用除nginx之外的其他技术,就可以了。
[请注意,我的网站正在使用cloudflare,因此它必须使用x-forward-for地址,而不是禁止简单的IP,否则我只是禁止cloudflare。
谢谢