0

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
3
  • You don't need the [some-path] bit. Anything after the /hi/ is automatically added after the / in the proxy_pass statement. See this document for details. Sep 17, 2020 at 15:23
  • @RichardSmith Should my proxy_pass statement then just be proxy_pass https://mywebsite.com/?
    – Amanda
    Sep 18, 2020 at 4:23
  • 1
    Yes, location /hi/ { proxy_pass https://mywebsite.com/; } will perform the transformation in your question. Sep 18, 2020 at 8:35

0

You must log in to answer this question.

Browse other questions tagged .