开发者

Static files served from CIFS Windows share through nginx/Ubuntu aren't fully sent to the browser

开发者 https://www.devze.com 2022-12-09 00:09 出处:网络
We have a Rails app with nginx front end. Users can upload files, which are stored on a Windows network share, and retrieve them later. The uploaded files are served statically through nginx.

We have a Rails app with nginx front end. Users can upload files, which are stored on a Windows network share, and retrieve them later. The uploaded files are served statically through nginx.

Downloading an image, for example, will only download a portion of the original image. Refreshing the page successfully downloads a little 开发者_高级运维more of the image with the server returning "206 Partial Content" responses.

There seems to be a problem with serving files from the CIFS connection - perhaps in determining correct file size? It certainly isn't the first time we've had trouble with CIFS.

The fstab entry for the mount looks like this:

//aioi-melts1.aioi.local/Staging_Claims /mnt/staging_claims cifs noperm,rw,credentials=/etc/samba/cred-file,uid=root,gid=network,file_mode=0770,dir_mode=0770,umask=0117 0 0

The request/response headers of the very first request look like this:

Response Headers
Server              nginx/0.5.34
Date                Wed, 14 Oct 2009 01:34:11 GMT
Content-Type        image/jpeg
Content-Length      5274820
Last-Modified       Wed, 14 Oct 2009 01:30:05 GMT
Connection          keep-alive
Accept-Ranges       bytes

Request Headers
Host                cx-staging
User-Agent          Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Accept              text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language     en-gb,en;q=0.5
Accept-Encoding     gzip,deflate
Accept-Charset      ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive          300
Connection          keep-alive
Cookie              _cx_new_session=29409d54cb14e3d4a9f6aba085e9f447

Any insight into the problem would be much appreciated.

Thanks, Nick.


It appears serving files from a NFS or CIFS (possibly others?) mount is incompatible with the nginx "sendfile" option. Turning off sendfile support has fixed my issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消