Problem with double slashes in URL when using nginx as proxy

alexk nginx-forum at nginx.us
Tue Jul 27 16:37:15 MSD 2010


Hi all,

I have web server where nginx is using as proxy for PHP scripts and web
server for static files. I use the following configuration:

server {
        listen 80;
        server_name *********.com;
        access_log /var/log/nginx/*********.com.access_log;
        location ~*
\.(jpg|jpeg|gif|png|css|js|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|xml|docx|xlsx)(\?\.+)?$
{
                root /var/www/**********.com/public/;
                index index.html index.php;
                expires max;
                access_log off;
        }
        location ~ /\.ht {
                deny all;
        }
        location / {
                proxy_pass http://127.0.0.1:8080/;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-for $remote_addr;
                proxy_set_header Host $host;
                proxy_connect_timeout 60;
                proxy_send_timeout 90;
                proxy_read_timeout 90;
                proxy_redirect off;
                proxy_set_header Connection close;
                proxy_pass_header Content-Type;
                proxy_pass_header Content-Disposition;
                proxy_pass_header Content-Length;
        }
}

Also there is apache2 running on port 8080 and process all non static
requests.

The problem in following - when I request
/en/all/all/filtered/246/1/date///-1//0 in logs of apache I see:

**.**.*.*** - - [27/Jul/2010:12:33:48 +0000] "GET
/en/all/all/filtered/246/1/date/-1/0 HTTP/1.0" 200 11548 "-"
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8)
Gecko/20100722 Firefox/3.6.8 GTB7.1"

Please notice that there is no double slashes already. Apache gets
"/en/all/all/filtered/246/1/date/-1/0" instead of requested
"/en/all/all/filtered/246/1/date///-1//0". And it creates problems in
the code.

And when I request Apache directly with
:8080/en/all/all/filtered/246/1/date///-1//0 it just works Ok. So I
suppose double slashes are missed somewhere in nginx.

I have nginx/0.7.67 installed.

Any ideas will be appreciated. Thanks!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,113427,113427#msg-113427




More information about the nginx mailing list