proxy_pass $variable

Igor Sysoev is at rambler-co.ru
Mon Jul 21 14:32:03 MSD 2008


On Sun, Jul 20, 2008 at 11:09:17PM +0200, Arkadiusz Patyk wrote:

> This works:
>      set $back backend;
>      if ($evil) { set $back evil;}
>      if ($back = backend) {  proxy_pass  http://backend; }
>      if ($back = evil)    {  proxy_pass  http://evil; }
> 
> this not:
>       set $back http://backend;
>       if ($evil) { set $back http://evil;}
>       proxy_pass $back;
> 
> 2008/07/20 23:02:55 [error] 13800#0: *7342 upstream sent no valid
> HTTP/1.0 header while reading response header from upstream, client: ,
> server: XXXX, request: "GET / HTTP/1.1", upstream:
> "http://10.9.14.20:8600", host: "XXXX:81"
> 
> Is possible to use variable in proxy_pass  ?

The string with variables in proxy_pass should be a full URL:

-      proxy_pass $back;
+      proxy_pass $back$request_uri;


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list