Welcome! Log In Create A New Profile

Advanced

Re: Dynamic proxy_pass hosts

Maxim Dounin
October 22, 2009 08:54AM
Hello!

On Thu, Oct 22, 2009 at 03:51:41PM +0400, Igor Katson wrote:

> Maxim Dounin wrote:
> >Hello!
> >
> >On Thu, Oct 22, 2009 at 01:17:16PM +0400, Igor Katson wrote:
> >
> >>In Apache it is possible to dynamically alter the proxy_pass remote
> >>host, i.e. like this
> >>
> >>RewriteRule ^/proxy_everything/(.*)$ http://$1 [P]
> >>
> >>So I cant extract the host from the URI, or from the environment
> >>variable etc.
> >>
> >>Is it possible to do the same with nginx?
> >
> >Yes, proxy_pass supports variables since 0.6.18. Note that you
> >must have resolver defined in nginx config if possible upstream
> >hosts include arbitrary hostnames (i.e. not only ip addresses and
> >names defined via upstream{} blocks).
> >
> >http://wiki.nginx.org/NginxHttpProxyModule#proxy_pass
> >http://wiki.nginx.org/NginxHttpCoreModule#resolver
> >
> >Note that wiki topics are a bit garbled, probably it's a good idea
> >to consult original docs too (use google translate if you don't
> >know Russian):
> >
> >http://sysoev.ru/nginx/docs/http/ngx_http_proxy_module.html#proxy_pass
> >http://sysoev.ru/nginx/docs/http/ngx_http_core_module.html#resolver
> >
> >Maxim Dounin
> >
> Thanks, Maxim! Well, I am russian, so I can read the docs. Are they
> more up-to-date or detailed? I usually read the wiki

The problem with wiki is that it's rarely synced with official
docs and may be seriously out of date. Additionally as it's wiki
it's regularly edited by users who ofter unaware how things really
work, and this results in wrong/misleading information in many cases.

In this particular case proxy_pass description in wiki has no full
documentation on proxy_pass work with variables (it has some
user-contributed content about variables in proxy_pass, but
written from completely different and wrong point of view), while
resolver just has no description.

Maxim Dounin
Subject Author Posted

Dynamic proxy_pass hosts

descentspb October 22, 2009 05:20AM

Re: Dynamic proxy_pass hosts

Maxim Dounin October 22, 2009 06:06AM

Re: Dynamic proxy_pass hosts

descentspb October 22, 2009 07:58AM

Re: Dynamic proxy_pass hosts

Maxim Dounin October 22, 2009 08:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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