Proxy Pass based on the first field in the URI

meir hazon meir.hazon at ev-box.com
Wed Sep 11 18:41:15 UTC 2019


Hi,

I don't think so, it should always be the first field of the URI but it
would be a random string. I have to proxy pass and rebuild the new URI
based on location at the original URI only.

Could you think of a way to do this?

Thanks so much,

Meir


On Wed, Sep 11, 2019 at 5:46 PM Francis Daly <francis at daoine.org> wrote:

> 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 at daoine.org
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20190911/a325d27a/attachment.htm>


More information about the nginx mailing list