0
随着nginx.conf
包括以下疯狂:IF子句打破LOCATION子句
location /beta/ {
proxy_pass http://otherhost/;
}
那么以下两个检索的工作:
curl -H 'User-Agent: Mozilla' http://localhost/beta/admin.html
curl -H 'User-Agent: iPhone' http://localhost/beta/admin.html
他们都找回http://otherhost/admin.html
当我改变nginx.conf阅读:
location /beta/ {
if ($http_user_agent ~ iPhone) {
}
proxy_pass http://otherhost/;
}
然后curl -H 'User-Agent: Mozilla' http://localhost/beta/admin.html
继续工作,但 curl -H 'User-Agent: iPhone' http://localhost/beta/admin.html
给出了404和OTHERHOST抱怨说,它没有一个叫beta/admin.html
文件。无论if
是否为空,都会发生这种情况。
咦?