<div dir="ltr"><div>Hi,</div><div> </div><div>I am trying to use Nginx as a reverse proxy and want to redirect to different upstream servers based on the URL. Looking to use the path prefix to distinguish the upstream servers to be used. But the issue is the path prefix gets sent to the upstream server which I don't want to. </div><div> </div><div>For eg., this is what I am trying to do:</div><div> </div><div>Nginx Server: nginx  (External IP)</div><div> </div><div>upstream 1: upstream1 (Internal IP)</div><div> </div><div>upstream 2: upstream2 (Internal IP)</div><div> </div><div>Desired outcome:</div><div><a href="http://nginx/server1">http://nginx/server1</a>  -------------->   <a href="http://upstream1">http://upstream1</a></div><div> </div><div><a href="http://nginx/server2">http://nginx/server2</a> ----------------> <a href="http://upstream2">http://upstream2</a></div><div> </div><div> </div><div>The problem I am having is that <a href="http://nginx/server1">http://nginx/server1</a> gets translated to <a href="http://upstream1/server1">http://upstream1/server1</a>. I am not able to remove the path prefix when the traffic gets directed to the upstream servers. </div><div> </div><div>I have tried most of the suggestions on the net:</div><div> </div><div> </div><div>location /server1/ {</div><div>  proxy_pass <a href="http://upstream1/">http://upstream1/</a>;</div><div>}</div><div> </div><div>(tried without slash)</div><div><div>location /server1/ {</div><div>  proxy_pass <a href="http://upstream1">http://upstream1</a>;</div><div>}</div><div> </div><div> </div><div><div>(tried using regex)</div><div><div>location /server1/ {</div><div>  rewrite ^/server1/(.*) /$1 break;</div><div>  proxy_pass <a href="http://upstream1/">http://upstream1/</a>;</div><div>}</div></div></div><div> </div><div> </div><div>All of the above results in varied behaviors but none gives the desired outcome. I am currently using a non-commercial version of nginx.</div><div> </div><div>And please note that I am using IP addresses everywhere and not hostnames. So name resolution issues anywhere here. </div><div> </div><div>Any guidance / help / pointers will be highly appreciated.</div><div> </div><div>Thanks</div><div>Vigs.</div></div></div>