With nginx.conf
including the following
location /beta/ {
proxy_pass http://otherhost/;
}
then both of the following retrievals work:
curl -H 'User-Agent: Mozilla' http://localhost/beta/admin.html
curl -H 'User-Agent: iPhone' http://localhost/beta/admin.html
They both retrieve http://otherhost/admin.html
When I change nginx.conf to read:
location /beta/ {
if ($http_user_agent ~ iPhone ) {
}
proxy_pass http://otherhost/;
}
Then curl -H 'User-Agent: Mozilla' http://localhost/beta/admin.html
continues to work but
curl -H 'User-Agent: iPhone' http://localhost/beta/admin.html
gives a 404 and otherhost complains that it doesn't have a file called beta/admin.html
. This happens whether if
is empty or not.
Huh?