Problem with variables in the proxy definition?

Ed W lists at wildgooses.com
Thu Apr 10 20:25:28 MSD 2008


Hi, have come across a problem with using variables.  Can anyone confirm
this is a bug?

For my rails app I reverse proxy to mongrel and this works ok:

      if (!-f $request_filename) {
        proxy_pass http://mongrel_cluster;
        break;
      }


But this does not:

    set $cluster  "mongrel_cluster"
      if (!-f $request_filename) {
        proxy_pass http://$cluster;
        break;
      }


In fact it passes it to the correct mongrel, but mongrel then complains
with error (anonymised a bit):

09/04/2008 21:16: HTTP parse error, malformed request (127.0.0.1):
#<Mongrel::HttpParserError: Invalid HTTP format, parsing fails.>
09/04/2008 21:16: REQUEST DATA: "GET  HTTP/1.0\r\nX-Real-IP:
1.2.3.4\r\nX-Forwarded-For: 1.2.3.4\r\nHost:
test.admin.mailasail.com\r\nConnection: close\r\nUser-Agent: Mozilla/5.0
(Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080311
Firefox/2.0.0.13\r\nAccept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\nAccept-Language: 


en-us,en;q=0.5\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset:
ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nReferer:
http://test.admin.abcd.com/login\r\nCookie: __utma=253725333.183964;
__utmz=253725333.120584.18.3.utmccn=(referral)|utmcsr=test.www.abcd.com|utmcct=/|utmcmd=referral; 


__utmc=25372533; _session_id=88aaaaaaaa21213ef1;
auth_token=f3aaaaaaaaaa5eb78\r\nCache-Control: max-age=0\r\n\r\n"



Can anyone help work around this (would simplify my configs a lot to be
able to make this work?

Thanks

Ed W







More information about the nginx mailing list