[英]Is there a way to block only the main domain in Nginx referrer but not the paths
I need to know if there is a way to block only the main domain as the referrer url's in Nginx. Like i want to block request with referrerurl: www.example.com
but not if the request is from referrerurl:www.example.com/page1/file1
I am not sure if there is a way to do it or if i would need a third party module, so any advice would be greatly helpful.我需要知道是否有一种方法可以仅阻止主域作为 Nginx 中的引荐来源网址。就像我想用referrerurl: www.example.com
但如果请求来自referrerurl:www.example.com/page1/file1
则不行referrerurl:www.example.com/page1/file1
我不确定是否有办法做到这一点,或者我是否需要第三方模块,所以任何建议都会很有帮助。 Thanks谢谢
You can use $http_referer
variable or valid_referers
directive combined with $invalid_referer
variable as stated in NGINX documentation: http://nginx.org/en/docs/http/ngx_http_referer_module.html .您可以使用$http_referer
变量或valid_referers
指令结合$invalid_referer
变量,如 NGINX 文档中所述: http://nginx.org/en/docs/http/ngx_http_referer_module.html 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.