1 message in ru.sysoev.nginxX-Accel-Redirect with proxy_pass
FromSent OnAttachments
Chris BoltJun 10, 2009 7:06 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:X-Accel-Redirect with proxy_passActions...
From:Chris Bolt (chri@gmail.com)
Date:Jun 10, 2009 7:06:04 pm
List:ru.sysoev.nginx

I'm having trouble with a problem that someone appears to have had trouble with in the past:

http://thread.gmane.org/gmane.comp.web.nginx.english/6619

I'd like a script to return a proxied file, and for nginx to handle the proxying. My configuration has:

location / { if ($request_uri ~* ^/(av01|av02)/(.*)) { set $regex_host $1.da; set $regex_uri $2; proxy_pass http://$regex_host/$regex_uri; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /www$fastcgi_script_name; }

test.php is:

<?php header("X-Accel-Redirect: /av01/robots.txt"); ?>

So I would like test.php to return the contents of http://av01.da/robots.txt

$ curl http://testnginx/av01/robots.txt User-Agent: * Disallow: /

That's working fine, as error log confirms:

2009/06/10 19:03:30 [notice] 4488#0: *94 "^/(av01|av02)/(.*)" matches "/av01/robots.txt", client: 10.0.0.25, server: testnginx.da, request: "GET /av01/robots.txt HTTP/1.1", host: "testnginx"

$ curl http://testnginx/test.php <html> <head><title>404 Not Found</title></head>

Hmm:

2009/06/10 19:04:21 [notice] 4488#0: *116 "^/(av01|av02)/(.*)" does not match "/test.php", client: 10.0.0.25, server: testnginx.da, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "testnginx" 2009/06/10 19:04:21 [error] 4488#0: *116 open() "/usr/html/av01/robots.txt" failed (2: No such file or directory), client: 10.0.0.25, server: testnginx.da, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "testnginx"

Is there a regression for this functionality, or am I trying to use a feature that isn't supported?