title: Rails ignoring config.action_dispatch.x_sendfile_header? Using Thin + Nginx
body: <p>I've set up a production environment running Rails 3.1.0rc6, Thin and Nginx.</p>
  
  <p>For some reason, having set <code>config.action_dispatch.x_sendfile_header = "X-Accel-Redirect"</code> in <code>config/environments/production.rb</code>, Rails seems to have completely ignored it; assets aren't being served, and the response headers for one file is as follows:</p>
  
  <pre><code>Server: nginx/1.0.5
  Date: Sun, 28 Aug 2011 00:26:08 GMT
  Content-Type: image/png
  Content-Length: 0
  Cache-Control: no-cache
  Last-Modified: Sat, 27 Aug 2011 23:47:35 GMT
  Etag: "af4810c52cb323d9ed061d1db5b4f296"
  X-UA-Compatible: IE=Edge,chrome=1
  X-Sendfile: /var/www/***/app/assets/images/bg-linen-light.png
  X-Runtime: 0.004595
  X-Content-Digest: da39a3ee5e6b4b0d3255bfef95601890afd80709
  Age: 0
  X-Rack-Cache: stale, valid, store
  
  200 OK
  </code></pre>
  
  <p>So it seems Rails is still setting the <code>X-Sendfile</code> header. I've tried adding the sendfile_header line to <code>config/application.rb</code>, but I'm guessing it's being overriden or ignored as well.</p>
  
  <p>My yml file for Thin:</p>
  
  <pre><code>--- 
  chdir: /var/www/***
  environment: production
  address: 0.0.0.0
  port: 3000
  timeout: 30
  log: log/thin.log
  pid: tmp/pids/thin.pid
  max_conns: 1024
  max_persistent_conns: 512
  require: []
  
  wait: 30
  servers: 1
  daemonize: true
  </code></pre>
  
  <p>Nginx vhost:</p>
  
  <pre><code>upstream *** {
      server 127.0.0.1:3000;
  }
  
  server {
      listen 80;
      server_name ***;
      root /var/www/***/public;
      index index.html;
  
      location / {
          proxy_set_header X-Real-IP  $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_redirect off;
  
          if (-f $request_filename/index.html) {
              rewrite (.*) $1/index.html break;
          }
  
          if (-f $request_filename.html) {
              rewrite (.*) $1.html break;
          }
  
          if (!-f $request_filename) {
              proxy_pass http://***;
              break;
          }
      }
  }
  </code></pre>
  
  <p>I've already tried <code>/etc/init.d/thin stop</code> then starting it again a few times, to no avail.</p>