Variables and proxy_pass

Cliff Wells cliff at develix.com
Sat Sep 30 05:02:48 MSD 2006


On Wed, 2006-09-27 at 15:48 -0400, Jonathan Dance wrote:

There's been at least one other inquiry about using variables in proxy
directives on the IRC channel:

> how can I obtain a proxy pass rule like the following: 
>
> proxy_pass http://localhost:7777/vhost/http/$host/; 
>
> unfortunately $host is not substituted do I need to use rewrite rules
first?

I think this is a reasonable request... would it be difficult to
implement?

Cliff


> Hello,
> 
> I'm now trying to use variables to allow me to re-use configuration
> files easily. The basic idea is:
> 
> upstream some-mongrel-cluster {
>    ...
> }
> 
> server {
>  ...
>  set $rails_proxy http://some-mongrel-cluster;
>  include macros/rails.conf;
> }
> 
> 
> Then, rails.conf has the standard rails stuff and this line:
> proxy_pass $rails_proxy;
> 
> Not surprisingly, this doesn't work. :) I am wondering what I might do
> to make it work, but I need to know:
> - Whether the problem is that the variable is not available from
> mod_http_proxy (since "set" is a mod_rewrite command?) or just that
> proxy_pass does not support using variables
> - If proxy_pass does not support variables, how do I make it do this?
> Where in the source is a good place to see how variables work?
> 
> Thanks!
> 
> JD
> 
-- 






More information about the nginx mailing list