nginxredirect问题与上游configuration

我有一个运行nginx和Plack / Starman的网站作为上游。 简单的configuration看起来像:

上游findmjob {
     server unix:/tmp/findmjob.sock;
 }

服务器{
  听80;
   server_name findmjob.com www.findmjob.com fb.findmjob.com;

   access_log /findmjob.com/log/access.log;
   error_log /findmjob.com/log/error.log info;

   root /findmjob.com/static;
  位置 / {
     try_files $ uri @proxy;
     access_logclosures;
    到期最大;
   }

  位置@proxy {
         proxy_set_header主机$ http_host;
         proxy_set_header X-Forwarded-Host $ http_host;
         proxy_set_header X-Real-IP $ remote_addr;
         proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
         proxy_pass http:// findmjob;
   }
 }

我有一些Perl代码返回一个redirect。 这意味着它可以在perl / plack下正常工作:

  Faylands-MacbookPro:findmjob.com fayland $ curl -I'http://findmjob.com:5000/job/GK3bmm+P4RG+2MTa2fVHmw/'
 HTTP / 1.0 301永久移动
date:2012年5月1日星期二06:14:38 GMT
服务器:HTTP :: Server :: PSGI
地点:http://findmjob.com/freelance/GK3bmm+P4RG+2MTa2fVHmw
服务器:Perl舞者1.3095
内容长度:0
 Content-Type:text / html; 字符集= utf-8的
 X-Powered-By:Perl Dancer 1.3095

正如你看到它真的与' http://findmjob.com/ '。

但是当我使用socks和nginx时,它会返回如下所示的内容:


 Faylands-MacbookPro:findmjob.com fayland $ curl -I'http://findmjob.com/job/GK3bmm+P4RG+2MTa2fVHmw/'
 HTTP / 1.1 301永久移动
服务器:nginx / 0.7.65
date:2012年5月1日星期二06:15:20 GMT
 Content-Type:text / html; 字符集= utf-8的
连接:保持活力
位置:.com / freelance / GK3bmm + P4RG + 2MTa2fVHmw
内容长度:0
 X-Powered-By:Perl Dancer 1.3095

http:// findmjob被丢弃,只剩下.com?

任何帮助真的很感激。

更新:升级到最新版本修复它。

 Faylands-MacbookPro:findmjob.com fayland $ curl -I'http://findmjob.com/job/GK3bmm+P4RG+2MTa2fVHmw/'
 HTTP / 1.1 301永久移动
服务器:nginx / 1.2.0
date:2012年5月1日星期二08:22:29 GMT
 Content-Type:text / html; 字符集= utf-8的
内容长度:0
连接:保持活力
地点:http://findmjob.com/freelance/GK3bmm+P4RG+2MTa2fVHmw
 X-Powered-By:Perl Dancer 1.3095

谢谢

这是因为你的上游定义为“ http:// findjob ”,而proxy_redirect是默认的

 proxy_redirect http://findjob /; 

这意味着nginx将从代理的Location: 去掉等于第一个arg的string到proxy_redirect ( http:// findjob )。

使用proxy_redirect off; 而是要解决这个问题。 检查文档的细节。