location /hg/ { sub_filter '"/' '"/hg/"; sub_filter_once off proxy_pass http://localhost:8080; }