proxy_pass
and proxy_redirect
have totally different functions. The proxy_redirect
directive is only involved with changing the Location
response header in a 3xx status message. See the NGINX proxy_redirect docs for details.
Your rewrite
statement does nothing other than prevent further modification of the URI. This line needs to be deleted otherwise it will inhibit proxy_pass
from mapping the URI. See below.
The proxy_pass
directive can map the URI (e.g. from /v2/platform/general/foo
to /foo
) by appending a URI value to the proxy_pass
value, which works in conjunction with the location
value. See this document for details.
For example:
location /v2/platform/general/ {
...
proxy_pass http://another-IP:8080/;
}
You may need to set the Host header only if your upstream server does not respond correctly to the value another-IP:8080
.
You may need to add one or more proxy_redirect
statements if your upstream server generates 3xx status responses with an incorrect value for the Location
header value.