Welcome! Log In Create A New Profile

Advanced

Re: Proxy Pass based on the first field in the URI

Francis Daly
September 11, 2019 11:48AM
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.

http://nginx.org/r/proxy_pass

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/ {
proxy_pass http://127.0.0.1/remote/;
}
"""

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

> https://yyy.com/bla/aa/er
> if $1 == bla proxy pass to http://xxx.com/aa/er
> if $1 == vv proxy pass to http://ccc.com/aa/er

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

Does that work for you?

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Proxy Pass based on the first field in the URI

meir hazon September 11, 2019 10:46AM

Re: Proxy Pass based on the first field in the URI

Francis Daly September 11, 2019 11:48AM

Re: Proxy Pass based on the first field in the URI

meir hazon September 11, 2019 02:42PM

Re: Proxy Pass based on the first field in the URI

Francis Daly September 11, 2019 05:50PM

Re: Proxy Pass based on the first field in the URI

meir hazon September 12, 2019 03:36AM

Re: Proxy Pass based on the first field in the URI

meir hazon September 12, 2019 03:42AM

Re: Proxy Pass based on the first field in the URI

j94305 September 11, 2019 11:55AM

Re: Proxy Pass based on the first field in the URI

meir hazon September 11, 2019 02:44PM

Re: Proxy Pass based on the first field in the URI

j94305 September 14, 2019 06:17PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 269
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready