本文介绍了NGINX不等于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
除非http_user_agent = xxx,否则客户希望我阻止对该页面的访问.
A client wants me to block access to a page unless the http_user_agent = xxx.
有没有办法做到这一点?我在想if else或if not函数,但这似乎不存在.
Is there a way to do this? I was thinking of an if else or if not function but this doesn't seem to exist.
如果我想阻止用户代理,可以执行以下操作,但是有一种方法只能允许该用户代理吗?
If I wanted to block a user agent I could do the below but is there a way to only allow that user agent?
if ($http_user_agent ~* (xxx) ) { return 403; }推荐答案
使用!~*运算符,它是~*的否定版本.
Use the !~* operator which is the negated version of ~*.
有关详细信息,请参见此文档.
See this document for details.
更多推荐
NGINX不等于
发布评论