Proxy_pass $variable

Hi

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 ?

Cheers,

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

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;

On Mon, 21 Jul 2008 14:32:03 +0400, you wrote:

  if ($evil) { set $back http://evil;}
  •  proxy_pass $back;
    
  •  proxy_pass $back$request_uri;
    

thanks, now it works.

Cheers,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs