Proxy Pass based on the first field in the URI

Francis Daly francis at
Wed Sep 11 15:46:22 UTC 2019

On Wed, Sep 11, 2019 at 04:45:21PM +0200, meir hazon wrote:

Hi there,

> I would also like to pass the message to the proxy without the first part
> of the URI but use the rest of it.

includes the section:

If the proxy_pass directive is specified with a URI, then when a request
is passed to the server, the part of a normalized request URI matching
the location is replaced by a URI specified in the directive:
  location /name/ {

With that sample config, you want two "location"s:

> if $1 == bla proxy pass to
> if $1 == vv proxy pass to

"/name/" == "/bla/"; "/remote/" == "/".
"/name/" == "/vv/"; "/remote/" == "/".

Does that work for you?

Francis Daly        francis at

More information about the nginx mailing list