NGINX - Using variable in proxy_pass breaks routing NGINX - Using variable in proxy_pass breaks routing nginx nginx

NGINX - Using variable in proxy_pass breaks routing


There is a small point you missed in documentation

When variables are used in proxy_pass:

location /name/ {  proxy_pass http://127.0.0.1$request_uri;}

In this case, if URI is specified in the directive, it is passed to the server as is, replacing the original request URI.

So you config needs to be changed to

set $pass_url http://test-microservice.example.com:80$request_uri;proxy_pass  $pass_url;