I have one NGINX acting as reverse proxy. I need to remove a substring string_1 from the URL, the rest of the URL is variable.
Example:
Origin: http://host:port/string_1/string_X/command?xxxxx
Destination: http://internal_host:port/string_X/command?xxxxx
nginx.conf:
location /string_1/ {
proxy_pass http://internal_host:port/$request_uri$query_string;
Thanks,
@pcamacho
It's really basic and simple. Just add
/path/
part toproxy_pass
and nginx will replacelocation
s prefix with that path. You need to replace/string_1/
with/
, so do it:I found the way to rewrite the proxy_pass URL:
Regards,
@pcamacho