I want to create a mapping such that, if a request comes in with a path some-path
gets appended to the proxy_pass
URL. For example as shown below:
location /hi/[some-path] {
proxy_pass https://mywebsite.com/[some-path]
}
Is there a way to do this? Is that possible?
Incoming Request:
https://foo.bar/hi/some-path/1/2/3
Proxy Passed To:
https://mywebsite.com/some-path/1/2/3
[some-path]
bit. Anything after the/hi/
is automatically added after the/
in theproxy_pass
statement. See this document for details.proxy_pass
statement then just beproxy_pass https://mywebsite.com/
?location /hi/ { proxy_pass https://mywebsite.com/; }
will perform the transformation in your question.