I added another location to rewrite the request and now its working fine. location ~ /myapp/ { rewrite ^/myapp/(.*)$ https://myservername/$1 redirect; } Posted at Nginx Forum: http://forum.nginx.org/read.php?2,179915,180974#msg-180974