Posted by g089h515r806 on August 25, 2010 at 7:08am
problem
My current nginx conf doesn't work with ubercart file download.
nginx can't get the files sold by ubercart file download
http://example.com/download/26215/dacaabe7a657626941cfc20ef4c45ad2
GET /download/26215/dacaabe7a657626941cfc20ef4c45ad2 HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 115
Connection: keep-alive
Referer: http://example.com/user/1/purchased-files
Cookie: SESS8687a77abae7a389136b7bef78e980e9=f4ce20605d98754e3b2ce26de06e7868; Hm_lvt_3a7af4b2789603cd3a64483ca3d1f193=1282094624115; __utma=111320475.2074167356.1281339306.1282293407.1282716645.14; __utmz=111320475.1282116751.12.2.utmcsr=video.2u4u.com.cn|utmccn=(referral)|utmcmd=referral|utmcct=/mtag/10545; Hm_lvt_116fea821e3bfb6c5a7d4b187a50b502=1282716644861; DRUPAL_UID=1; has_js=1; __utmb=111320475.22.10.1282716645; __utmc=111320475; Hm_lpvt_116fea821e3bfb6c5a7d4b187a50b502=1282717811539
HTTP/1.1 302 Found
Server: nginx
Date: Wed, 25 Aug 2010 06:30:04 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
X-Powered-By: PHP/5.2.6
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: store, no-cache, must-revalidate, post-check=0, pre-check=0
Location: http://example.com/user/1/purchased-files
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
apache (at port 7788) can get the file without problem, hence it's not drupal's fault.
http://example.com:7788/download/159/0cb0936b8c3a988a6f0b0fb90dbb140f
GET /download/159/0cb0936b8c3a988a6f0b0fb90dbb140f HTTP/1.1
Host: example.com:7788
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 115
Connection: keep-alive
Referer: http://example.com:7788/user/1/purchased-files
Cookie: SESS8687a77abae7a389136b7bef78e980e9=f4ce20605d98754e3b2ce26de06e7868; Hm_lvt_3a7af4b2789603cd3a64483ca3d1f193=1282094624115; __utma=111320475.2074167356.1281339306.1282293407.1282716645.14; __utmz=111320475.1282116751.12.2.utmcsr=video.2u4u.com.cn|utmccn=(referral)|utmcmd=referral|utmcct=/mtag/10545; Hm_lvt_116fea821e3bfb6c5a7d4b187a50b502=1282716644861; DRUPAL_UID=1; has_js=1; __utmb=111320475.25.10.1282716645; __utmc=111320475; Hm_lpvt_116fea821e3bfb6c5a7d4b187a50b502=1282717854504
HTTP/1.1 200 OK
Date: Wed, 25 Aug 2010 06:30:46 GMT
Server: Apache/2.0.63
X-Powered-By: PHP/5.2.6
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: cache, must-revalidate
Accept-Ranges: bytes
Content-Range: bytes 0-77384789/77384790
Content-Disposition: attachment; filename="zhangzhongbao.mp3.zip"
Vary: Accept-Encoding
Content-Encoding: gzip
Connection: close
Transfer-Encoding: chunked
Content-Type: application/zip
my nginx conf
I use omega8cc's nginx conf. I added the following part to take care of the ubercart file download but it doesn't work.
location /download/* {
# for ubercart file download pages at user/uid/purchased-files
# proxy it to apache, or users can't download their files
# need to ask why on drupal groups
proxy_pass http://apache;
# i think we need to give apache the header?
# how do i pass the sessionid to apache?
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
}
This doesn't work. I get the same header as without the directive.
Solution
Not known.
A emergency solution?
Would someone tell me how to rewrite the uri of
example.org/download/nid/md5sum
to
example.org:7788/download/nid/md5sum
in the location /download/*
Comments
This sounds like a tough one
This sounds like a tough one to diagnose with limited info. Are you using nginx in front of apache for all requests or some type of php-cgi?
What about:
location ~ ^/download/.*$ {proxy_pass http://localhost:7788; # or whatever you need to get to apache with the port specified
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
}
If you want to post or send me the full config and possibly also a debug log, I can take a look.
@brianmercer We use nginx as
@brianmercer
We use nginx as reverse proxy before apache, to have the separation of static and dynamic content. Nginx takes care of most static files and apache processes php.
I temporarily solved the problem by using the rewrite directive in that location.
With this location directive, users access the site through port 80, and won't notice the download is at port 7788 unless they look at the header.
I don't understand 1. why proxy_pass doesn't work. 2. Is there someone running ubercart on a nginx/php-fcgi env? Do you have this problem? By reading the uc_file module source code, I don't think the ubercart code is strictly tighten to apache. Then why the proxy_pass doesn't work?
Maybe, just maybe apache doesn't get the user ip correctly?
Here is the relevant code in uc_file.page.inc
Here is what my guess is based on:
I set up a test install with
I set up a test install with uc file download on my nginx+php-fpm test server and it worked fine.
Did you try to add the x-forwarded-for header?
location ~ ^/download/.*$ {proxy_pass http://localhost:7788; # or whatever you need to get to apache with the port specified
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
I added the directive (
I added the directive ( proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ).
Still, it didn't work.
Since you tested on nginx+php-fpm and that worked, I am thinking the problem is on my part, probably some apache configuration (which is a standard conf comes with apache, only a few timeout/server pool tweaking, and disable keepalive since apache is at the backend).
I will use the rewrite way for the moment.
I can't run php-fpm for the moment because some issues with php-soap. I found some other obscure issues with nginx+apache (like global redirect module).
Some issues disappeared when run with php-fpm (thank you very much for that!), it makes me think it's because the environment of my set up not some faults in the nginx conf.
I thought by using nginx as reverse proxy with apache (separation of static and dynamic content) was the easier to implement and would attract more people to try out nginx with drupal. I guess I was wrong. Because, it seems to me most people in this group run nginx+php-fpm directly and there weren't many issues related to apache except from me. Either they all worked out smoothly or nobody is using it?
Can't reproduse
Sorry, I can't reproduce the problem using apache as a backend. I'm using this setup:
pressflow-6.19.92 (I also switched to drupal-6.19)
uc_file-6.x-2.4 (just updated)
root@fennel:~# cat /etc/nginx/sites-enabled/apache
server {
listen 192.168.1.102:80;
server_name _apache
t11.brianmercer.com
#t14.brianmercer.com
;
access_log /var/log/nginx/$host.access.log;
root /var/www/$host/public;
index index.php;
add_header x-nginx-config "_apache"; #for debugging use
location / {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
location = /index.php {
rewrite ^/(.*)/$ /$1 permanent; # remove trailing slashes
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js)$ {
access_log off;
error_log /dev/null crit;
expires 45d;
}
location = /favicon.ico {
try_files /favicon.ico =204;
access_log off;
error_log /dev/null crit;
}
}
root@fennel:~# cat /etc/apache2/sites-enabled/t11.brianmercer.com
<VirtualHost *:8080>
ServerName t11.brianmercer.com
ServerAlias t11.brianmercer.com
ServerAdmin null@null.com
DocumentRoot /var/www/t11.brianmercer.com/public
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
LogLevel warn
ErrorLog /var/log/apache2/error.log
</VirtualHost>
and this is the debug output:
root@fennel:~# tail -f -n 0 /var/log/nginx/error.log
2010/08/27 09:08:17 [debug] 26944#0: *5884 accept: 192.168.1.101 fd:7
2010/08/27 09:08:17 [debug] 26944#0: *5884 event timer add: 7: 60000:3014303142
2010/08/27 09:08:17 [debug] 26944#0: *5884 epoll add event: fd:7 op:1 ev:80000001
2010/08/27 09:08:17 [debug] 26944#0: *5884 malloc: 088459F0:676
2010/08/27 09:08:17 [debug] 26944#0: *5884 malloc: 08845C98:1024
2010/08/27 09:08:17 [debug] 26944#0: *5884 malloc: 088D6C40:4096
2010/08/27 09:08:17 [debug] 26944#0: *5884 http process request line
2010/08/27 09:08:17 [debug] 26944#0: *5884 recv: fd:7 633 of 1024
2010/08/27 09:08:17 [debug] 26944#0: *5884 http request line: "GET /download/1/2dc43e63fdbca83af82b76f93a8e007a HTTP/1.1"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http uri: "/download/1/2dc43e63fdbca83af82b76f93a8e007a"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http args: ""
2010/08/27 09:08:17 [debug] 26944#0: *5884 http exten: ""
2010/08/27 09:08:17 [debug] 26944#0: *5884 http process request header line
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header: "Host: t11.brianmercer.com"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header: "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b4) Gecko/20100818 Firefox/4.0b4 (.NET CLR 3.5.30729)"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header: "Accept-Language: en-us,en;q=0.8,zh-cn;q=0.5,zh;q=0.3"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header: "Accept-Encoding: gzip, deflate"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header: "Accept-Charset: UTF-8,*"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header: "Keep-Alive: 115"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header: "Connection: keep-alive"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header: "Referer: http://t11.brianmercer.com/user/23/purchased-files"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header: "Cookie: SESS56b851c6d83a254bd5215063f9301b4a=6e8466f1ae7f6ed0cfaa88540c3c51a6; SESSac69b53fca8fa5e95c3a7931d2339b78=5bd8cc10ca8d4255dc70f1d985b11936"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http header done
2010/08/27 09:08:17 [debug] 26944#0: *5884 event timer del: 7: 3014303142
2010/08/27 09:08:17 [debug] 26944#0: *5884 generic phase: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 add cleanup: 088D7224
2010/08/27 09:08:17 [debug] 26944#0: *5884 generic phase: 1
2010/08/27 09:08:17 [debug] 26944#0: *5884 test location: "/"
2010/08/27 09:08:17 [debug] 26944#0: *5884 test location: "index.php"
2010/08/27 09:08:17 [debug] 26944#0: *5884 test location: "favicon.ico"
2010/08/27 09:08:17 [debug] 26944#0: *5884 test location: ~ "^.+\.(jpg|jpeg|gif|png|ico|css|js)$"
2010/08/27 09:08:17 [debug] 26944#0: *5884 using configuration "/"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http cl:-1 max:524288000
2010/08/27 09:08:17 [debug] 26944#0: *5884 generic phase: 3
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script regex: "^/(.*)$"
2010/08/27 09:08:17 [notice] 26944#0: *5884 "^/(.*)$" matches "/download/1/2dc43e63fdbca83af82b76f93a8e007a", client: 192.168.1.101, server: _apache, request: "GET /download/1/2dc43e63fdbca83af82b76f93a8e007a HTTP/1.1", host: "t11.brianmercer.com", referrer: "http://t11.brianmercer.com/user/23/purchased-files"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "/index.php"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script args
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "q="
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script capture: "download/1/2dc43e63fdbca83af82b76f93a8e007a"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script regex end
2010/08/27 09:08:17 [notice] 26944#0: *5884 rewritten data: "/index.php", args: "q=download/1/2dc43e63fdbca83af82b76f93a8e007a", client: 192.168.1.101, server: _apache, request: "GET /download/1/2dc43e63fdbca83af82b76f93a8e007a HTTP/1.1", host: "t11.brianmercer.com", referrer: "http://t11.brianmercer.com/user/23/purchased-files"
2010/08/27 09:08:17 [debug] 26944#0: *5884 post rewrite phase: 4
2010/08/27 09:08:17 [debug] 26944#0: *5884 uri changes: 11
2010/08/27 09:08:17 [debug] 26944#0: *5884 test location: "/"
2010/08/27 09:08:17 [debug] 26944#0: *5884 test location: "index.php"
2010/08/27 09:08:17 [debug] 26944#0: *5884 using configuration "=/index.php"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http cl:-1 max:524288000
2010/08/27 09:08:17 [debug] 26944#0: *5884 generic phase: 3
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script regex: "^/(.*)/$"
2010/08/27 09:08:17 [notice] 26944#0: *5884 "^/(.*)/$" does not match "/index.php", client: 192.168.1.101, server: _apache, request: "GET /download/1/2dc43e63fdbca83af82b76f93a8e007a HTTP/1.1", host: "t11.brianmercer.com", referrer: "http://t11.brianmercer.com/user/23/purchased-files"
2010/08/27 09:08:17 [debug] 26944#0: *5884 post rewrite phase: 4
2010/08/27 09:08:17 [debug] 26944#0: *5884 generic phase: 5
2010/08/27 09:08:17 [debug] 26944#0: *5884 add cleanup: 088D73E8
2010/08/27 09:08:17 [debug] 26944#0: *5884 generic phase: 6
2010/08/27 09:08:17 [debug] 26944#0: *5884 generic phase: 7
2010/08/27 09:08:17 [debug] 26944#0: *5884 access phase: 8
2010/08/27 09:08:17 [debug] 26944#0: *5884 access phase: 9
2010/08/27 09:08:17 [debug] 26944#0: *5884 post access phase: 10
2010/08/27 09:08:17 [debug] 26944#0: *5884 try files phase: 11
2010/08/27 09:08:17 [debug] 26944#0: *5884 http init upstream, client timer: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 epoll add event: fd:7 op:3 ev:80000005
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "X-Real-IP: "
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script var: "192.168.1.101"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "
"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "Host: "
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script var: "t11.brianmercer.com"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "
"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "X-Forwarded-For: "
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script var: "192.168.1.101"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "
"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "Connection: close
"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b4) Gecko/20100818 Firefox/4.0b4 (.NET CLR 3.5.30729)"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Accept-Language: en-us,en;q=0.8,zh-cn;q=0.5,zh;q=0.3"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Accept-Encoding: gzip, deflate"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Accept-Charset: UTF-8,*"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Referer: http://t11.brianmercer.com/user/23/purchased-files"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Cookie: SESS56b851c6d83a254bd5215063f9301b4a=6e8466f1ae7f6ed0cfaa88540c3c51a6; SESSac69b53fca8fa5e95c3a7931d2339b78=5bd8cc10ca8d4255dc70f1d985b11936"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header:
"GET /index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a HTTP/1.0
X-Real-IP: 192.168.1.101
Host: t11.brianmercer.com
X-Forwarded-For: 192.168.1.101
Connection: close
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b4) Gecko/20100818 Firefox/4.0b4 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.8,zh-cn;q=0.5,zh;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: UTF-8,*
Referer: http://t11.brianmercer.com/user/23/purchased-files
Cookie: SESS56b851c6d83a254bd5215063f9301b4a=6e8466f1ae7f6ed0cfaa88540c3c51a6; SESSac69b53fca8fa5e95c3a7931d2339b78=5bd8cc10ca8d4255dc70f1d985b11936
"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http cleanup add: 088D79AC
2010/08/27 09:08:17 [debug] 26944#0: *5884 get rr peer, try: 2
2010/08/27 09:08:17 [debug] 26944#0: *5884 get rr peer, current: 0 1
2010/08/27 09:08:17 [debug] 26944#0: *5884 socket 11
2010/08/27 09:08:17 [debug] 26944#0: *5884 epoll add connection: fd:11 ev:80000005
2010/08/27 09:08:17 [debug] 26944#0: *5884 connect to 127.0.0.1:8080, fd:11 #5885
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream connect: -2
2010/08/27 09:08:17 [debug] 26944#0: *5884 event timer add: 11: 60000:3014303142
2010/08/27 09:08:17 [debug] 26944#0: *5884 http run request: "/index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream check client, write event:1, "/index.php"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream recv(): -1 (11: Resource temporarily unavailable)
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream request: "/index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream send request handler
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream send request
2010/08/27 09:08:17 [debug] 26944#0: *5884 chain writer buf fl:1 s:681
2010/08/27 09:08:17 [debug] 26944#0: *5884 chain writer in: 088D79C8
2010/08/27 09:08:17 [debug] 26944#0: *5884 writev: 681
2010/08/27 09:08:17 [debug] 26944#0: *5884 chain writer out: 00000000
2010/08/27 09:08:17 [debug] 26944#0: *5884 event timer del: 11: 3014303142
2010/08/27 09:08:17 [debug] 26944#0: *5884 event timer add: 11: 60000:3014303143
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream request: "/index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream process header
2010/08/27 09:08:17 [debug] 26944#0: *5884 malloc: 0884E340:4096
2010/08/27 09:08:17 [debug] 26944#0: *5884 recv: fd:11 440 of 4096
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy status 200 "200 OK"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Date: Fri, 27 Aug 2010 13:08:17 GMT"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Server: Apache/2.2.14 (Ubuntu)"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "X-Powered-By: PHP/5.3.3-1ubuntu3"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Last-Modified: Wed, 25 Aug 2010 14:23:39 GMT"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Cache-Control: cache, must-revalidate"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "ETag: e565e2e4e78d4ee1917a26622886e945"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Pragma: public"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Accept-Ranges: bytes"
2010/08/27 09:08:17 [debug] 26944#0: *5884 malloc: 0884F348:4096
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Content-Range: bytes 0--1/0"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Content-Disposition: attachment; filename="Domain Watchlist.txt""
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Connection: close"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header: "Content-Type: text/plain; charset=utf-8"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http proxy header done
2010/08/27 09:08:17 [debug] 26944#0: *5884 HTTP/1.1 200 OK
Server: nginx
Date: Fri, 27 Aug 2010 13:08:17 GMT
Content-Type: text/plain; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Encoding
X-Powered-By: PHP/5.3.3-1ubuntu3
Last-Modified: Wed, 25 Aug 2010 14:23:39 GMT
Cache-Control: cache, must-revalidate
ETag: e565e2e4e78d4ee1917a26622886e945
Pragma: public
Content-Range: bytes 0--1/0
Content-Disposition: attachment; filename="Domain Watchlist.txt"
x-nginx-config: apache
Content-Encoding: gzip
2010/08/27 09:08:17 [debug] 26944#0: *5884 write new buf t:1 f:0 0884F564, pos 0884F564, size: 500 file: 0, size: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 http write filter: l:0 f:0 s:500
2010/08/27 09:08:17 [debug] 26944#0: *5884 http cacheable: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream process upstream
2010/08/27 09:08:17 [debug] 26944#0: *5884 pipe read upstream: 1
2010/08/27 09:08:17 [debug] 26944#0: *5884 pipe preread: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 readv: 1:3656
2010/08/27 09:08:17 [debug] 26944#0: *5884 readv() not ready (11: Resource temporarily unavailable)
2010/08/27 09:08:17 [debug] 26944#0: *5884 pipe recv chain: -2
2010/08/27 09:08:17 [debug] 26944#0: *5884 pipe buf free s:0 t:1 f:0 0884E340, pos 0884E4F8, size: 0 file: 0, size: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 event timer: 11, old: 3014303143, new: 3014303172
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream request: "/index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream dummy handler
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream request: "/index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream process upstream
2010/08/27 09:08:17 [debug] 26944#0: *5884 pipe read upstream: 1
2010/08/27 09:08:17 [debug] 26944#0: *5884 readv: 1:3656
2010/08/27 09:08:17 [debug] 26944#0: *5884 pipe recv chain: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 pipe buf free s:0 t:1 f:0 0884E340, pos 0884E4F8, size: 0 file: 0, size: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 pipe write downstream: 1
2010/08/27 09:08:17 [debug] 26944#0: *5884 pipe write downstream done
2010/08/27 09:08:17 [debug] 26944#0: *5884 event timer: 11, old: 3014303143, new: 3014303186
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream exit: 00000000
2010/08/27 09:08:17 [debug] 26944#0: *5884 finalize http upstream request: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 finalize http proxy request
2010/08/27 09:08:17 [debug] 26944#0: *5884 free rr peer 2 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 close http upstream connection: 11
2010/08/27 09:08:17 [debug] 26944#0: *5884 event timer del: 11: 3014303143
2010/08/27 09:08:17 [debug] 26944#0: *5884 http upstream temp fd: -1
2010/08/27 09:08:17 [debug] 26944#0: *5884 http output filter "/index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a"
2010/08/27 09:08:17 [debug] 26944#0: *5884 copy filter: "/index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http postpone filter "/index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a" BF8561F8
2010/08/27 09:08:17 [debug] 26944#0: *5884 http gzip filter
2010/08/27 09:08:17 [debug] 26944#0: *5884 malloc: 088E9970:270336
2010/08/27 09:08:17 [debug] 26944#0: *5884 gzip alloc: n:1 s:5824 a:8192 p:088E9970
2010/08/27 09:08:17 [debug] 26944#0: *5884 gzip alloc: n:32768 s:2 a:65536 p:088EB970
2010/08/27 09:08:17 [debug] 26944#0: *5884 gzip alloc: n:32768 s:2 a:65536 p:088FB970
2010/08/27 09:08:17 [debug] 26944#0: *5884 gzip alloc: n:32768 s:2 a:65536 p:0890B970
2010/08/27 09:08:17 [debug] 26944#0: *5884 gzip alloc: n:16384 s:4 a:65536 p:0891B970
2010/08/27 09:08:17 [debug] 26944#0: *5884 gzip in: 0884F878
2010/08/27 09:08:17 [debug] 26944#0: *5884 gzip in_buf:0884F80C ni:00000000 ai:0
2010/08/27 09:08:17 [debug] 26944#0: *5884 malloc: 08864B68:8192
2010/08/27 09:08:17 [debug] 26944#0: *5884 deflate in: ni:00000000 no:08864B68 ai:0 ao:8192 fl:4 redo:0
2010/08/27 09:08:17 [debug] 26944#0: *5884 deflate out: ni:00000000 no:08864B6A ai:0 ao:8190 rc:1
2010/08/27 09:08:17 [debug] 26944#0: *5884 gzip in_buf:0884F80C pos:00000000
2010/08/27 09:08:17 [debug] 26944#0: *5884 free: 088E9970
2010/08/27 09:08:17 [debug] 26944#0: *5884 http chunk: 10
2010/08/27 09:08:17 [debug] 26944#0: *5884 http chunk: 10
2010/08/27 09:08:17 [debug] 26944#0: *5884 write old buf t:1 f:0 0884F564, pos 0884F564, size: 500 file: 0, size: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 write new buf t:1 f:0 00000000, pos 0884F944, size: 4 file: 0, size: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 write new buf t:0 f:0 00000000, pos 080D29C4, size: 10 file: 0, size: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 write new buf t:1 f:0 08864B68, pos 08864B68, size: 10 file: 0, size: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 write new buf t:0 f:0 00000000, pos 080C6A9C, size: 7 file: 0, size: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 http write filter: l:1 f:1 s:531
2010/08/27 09:08:17 [debug] 26944#0: *5884 http write filter limit 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 writev: 531
2010/08/27 09:08:17 [debug] 26944#0: *5884 http write filter 00000000
2010/08/27 09:08:17 [debug] 26944#0: *5884 copy filter: 0 "/index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http finalize request: 0, "/index.php?q=download/1/2dc43e63fdbca83af82b76f93a8e007a" 1
2010/08/27 09:08:17 [debug] 26944#0: *5884 http close request
2010/08/27 09:08:17 [debug] 26944#0: *5884 http log handler
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "/var/www/"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script var: "t11.brianmercer.com"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "/public"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: "/var/log/nginx/"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script var: "t11.brianmercer.com"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http script copy: ".access.log"
2010/08/27 09:08:17 [debug] 26944#0: *5884 http log "/var/log/nginx/t11.brianmercer.com.access.log"
2010/08/27 09:08:17 [debug] 26944#0: *5884 add cleanup: 0884FB24
2010/08/27 09:08:17 [debug] 26944#0: *5884 http log #11
2010/08/27 09:08:17 [debug] 26944#0: *5884 run cleanup: 0884FB24
2010/08/27 09:08:17 [debug] 26944#0: *5884 file cleanup: fd:11
2010/08/27 09:08:17 [debug] 26944#0: *5884 free: 08864B68
2010/08/27 09:08:17 [debug] 26944#0: *5884 free: 00000000
2010/08/27 09:08:17 [debug] 26944#0: *5884 free: 0884E340
2010/08/27 09:08:17 [debug] 26944#0: *5884 free: 088D6C40, unused: 0
2010/08/27 09:08:17 [debug] 26944#0: *5884 free: 0884F348, unused: 2060
2010/08/27 09:08:17 [debug] 26944#0: *5884 close http connection: 7
2010/08/27 09:08:17 [debug] 26944#0: *5884 free: 08845C98
2010/08/27 09:08:17 [debug] 26944#0: *5884 free: 088459F0
2010/08/27 09:08:17 [debug] 26944#0: *5884 free: 0883D6A8, unused: 56
I did not enable these settings in settings.php
/*** reverse_proxy accepts a boolean value.
*
* Enable this setting to determine the correct IP address of the remote
* client by examining information stored in the X-Forwarded-For headers.
* X-Forwarded-For headers are a standard mechanism for identifying client
* systems connecting through a reverse proxy server, such as Squid or
* Pound. Reverse proxy servers are often used to enhance the performance
* of heavily visited sites and may also provide other site caching,
* security or encryption benefits. If this Drupal installation operates
* behind a reverse proxy, this setting should be enabled so that correct
* IP address information is captured in Drupal's session management,
* logging, statistics and access management systems; if you are unsure
* about this setting, do not have a reverse proxy, or Drupal operates in
* a shared hosting environment, this setting should be set to disabled.
*/
# 'reverse_proxy' => TRUE,
/**
* reverse_proxy accepts an array of IP addresses.
*
* Each element of this array is the IP address of any of your reverse
* proxies. Filling this array Drupal will trust the information stored
* in the X-Forwarded-For headers only if Remote IP address is one of
* these, that is the request reaches the web server from one of your
* reverse proxies. Otherwise, the client could directly connect to
* your web server spoofing the X-Forwarded-For headers.
*/
# 'reverse_proxy_addresses' => array('a.b.c.d', ...),
# );
I hope you find the issue. Once you get it working, it seems like a good case for using X-Send.
I switched the site from
I switched the site from apache backend to php-fcgi then the problem went away. Like you said in the previous comment, if i run drupal+ubercart with php-fcgi, the /download location rewrite in nginx conf isn't necessary.
Thank you for your detailed testing and instruction. I tried your apache and nginx config, but it still failed in my case.
I think this confirms something is wrong with my apache but i just can't put my fingers on it.
So, this probably is a non-issue .
Anyway, I will use the php-fcgi for that ubercart site for the moment.
Me too: ubercart file download link not working under NGINX
The OP's issue seems very close to mine, but I have no apache involved. When I click the UC file product download link, I only get a 302 redirect to user/x/purchased-files page. There is no Content-Disposition;filename header in the response, so the browser never prompts me to save a file. Could nginx be stripping out the disposition response header?
I use: drupal 6.19, UC 6.x-2.4, nginx 0.7.67, php 5.3.3 (with php-fpm built in), and apc. File downloads have been super reliable until I made the latest upgrades. I see this condition on two installs where nginx and php (with php-fpm) have been updated. I'm going to debug the uc_file code tonight and see if the headers are simply not making it past nginx on the response. I made a similar post at ubercart forum at http://www.ubercart.org/forum/support/18042/clicking_file_download_link_...
You may wish to try a
You may wish to try a different nginx config.
Yours (http://www.ubercart.org/files/file-download-issue-nginx-conf.txt) does not follow current nginx best practices. Check out yhager's config here http://github.com/yhager/nginx_drupal or mine at http://test.brianmercer.com/content/nginx-configuration-drupal
I've also had problems if I don't strip the leading slash from the query string. So I would suggest instead of this rewrite here:
rewrite ^(.)$ /index.php?q=$1 last;you use:
rewrite ^/(.)$ /index.php?q=$1 last;but I suggest you update your entire config to try_files and @drupal internal location.