NGINX Proxy_Pass remove url substring
It's really basic and simple. Just add /path/
part to proxy_pass
and nginx will replace location
s prefix with that path. You need to replace /string_1/
with /
, so do it:
location /string_1/ {
proxy_pass http://internal_host:port/;
}
I found the way to rewrite the proxy_pass URL:
location /string_1/ {
if ($request_uri ~* "/string_1/(.*)") {
proxy_pass http://internal_host:port/$1;
}
}
Regards,
@pcamacho