views:

212

answers:

1

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.

+1  A: 

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.

Nick T