Just got rid of the if entirely. That logic was totally unnecessary so now it's just: proxy_pass http://dev.example.com; Posted at Nginx Forum: http://forum.nginx.org/read.php?2,181397,181459#msg-181459