Welcome! Log In Create A New Profile

Advanced

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

meir hazon
September 11, 2019 02:44PM
Hi,

It looks great, I will try it out and let you know.

Thanks so much,

Meir

On Wed, Sep 11, 2019 at 5:56 PM j94305 <nginx-forum@forum.nginx.org> wrote:

> Try something like this:
>
> map $urlprefix $urlproxy {
> "foo" "https://foohost.foo.com";
> "bar" "http://barhost.blah.com";
> "fie" "https://fie.special.domain.com/blubb";
> default "https://standard.com";
> }
>
> [...]
>
> location ~ "^/(?<urlprefix>[^/]+)(?<urlsuffix>/.*)$" {
>
> [...]
> proxy_pass "$urlproxy$urlsuffix$is_args$args";
> [...]
> }
>
> You can dynamically determine the host (including a URL piece, if
> necessary)
> with the "map", and use the mapped proxy prefix then in the proxy_pass
> directive. If whatever lies beyond the NGINX requires URL arguments, don't
> forget the $is_args$args part.
>
> --j.
>
> Posted at Nginx Forum:
> https://forum.nginx.org/read.php?2,285607,285609#msg-285609
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
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: 290
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