Welcome! Log In Create A New Profile

Advanced

Problem with double slashes in URL when using nginx as proxy

July 27, 2010 08:37AM
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!
Subject Author Posted

Problem with double slashes in URL when using nginx as proxy

alexk July 27, 2010 08:37AM

Re: Problem with double slashes in URL when using nginx as proxy

Igor Sysoev July 27, 2010 08:44AM

Re: Problem with double slashes in URL when using nginx as proxy

alexk July 27, 2010 10:33AM

Re: Problem with double slashes in URL when using nginx as proxy

alexk September 10, 2010 08:05AM

Re: Problem with double slashes in URL when using nginx as proxy

alexk September 10, 2010 08:12AM

Re: Problem with double slashes in URL when using nginx as proxy

Igor Sysoev September 10, 2010 08:24AM

Re: Problem with double slashes in URL when using nginx as proxy

alexk September 16, 2010 07:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 77
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready