Welcome! Log In Create A New Profile

Advanced

Re: Using correct variable for proxy_pass

Maxim Dounin
November 21, 2018 08:22AM
Hello!

On Wed, Nov 21, 2018 at 08:53:40AM +0000, Rob Fulton wrote:

> On 19/11/2018 13:12, Maxim Dounin wrote:
> >
> > If you want to use variables in the proxy_pass and at the same
> > time want to preserve effect of nginx internal URI changes such as
> > due to rewrites, consider using an empty URI compontent in the
> > proxy_pass. For example:
> >
> > set $backend "http://example.com";
> > proxy_pass $backend;
> >
> Thanks for the guidance however we are proxying to a specific folder on
> our backend servers, i.e
>
> set $backend "http://example.com/blue/content";
>
> proxy_pass $backend
>
> Is there a way to make this work in this scenario?

Try changing URI in nginx with rewrite instead of trying to
construct URI in proxy_pass by hand, e.g.:

set $backend "http://example.com";
rewrite ^(.*) /blue/content$1 break;
proxy_pass $backend;

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Using correct variable for proxy_pass

Rob Fulton November 19, 2018 04:48AM

Re: Using correct variable for proxy_pass

Maxim Dounin November 19, 2018 08:14AM

Re: Using correct variable for proxy_pass

Rob Fulton November 21, 2018 03:54AM

Re: Using correct variable for proxy_pass

Maxim Dounin November 21, 2018 08:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 315
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