views:

16

answers:

0

I'm using nginx + passenger + ree to host my web app in a linode vps. The config i'm using is the following:

user  ***;
worker_processes  4;

events {
    worker_connections  1024;
}

http {
    passenger_root /opt/passenger-2.2.15;
    passenger_ruby /opt/ruby-enterprise-1.8.7-2010.02/bin/my_ruby.sh;
    passenger_max_pool_size 10;

    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    gzip  on;
    gzip_http_version 1.1;
    gzip_comp_level 6;
    gzip_proxied any;
    gzip_buffers 16 8k;
    gzip_types text/plain text/html text/css application/json \ 
    application/x-javascript text/xml application/xml \
    application/xml+rss text/javascript;

    server {
     listen 80;
     server_name ******;
     root /****/***/public;
     passenger_enabled on;
     access_log ****.access.log;

        #expire headers to the assets 
        location ~* \.(js|jpg|jpeg|gif|png)$ {
          if (-f $request_filename) {
                expires      max;
            break;
          }
        }

 error_page 500 502 503 504 /50x.html;
        location = /50x.html {
         root html;
        }
    }

When i use:

p = Package.latest.first
last_modified = (p.nil?) ? 1.hour.ago : p.updated_at.utc

if stale?(:last_modified => last_modified, :etag => p)
  @persons_set = params[:n]
  @packages = Package.find(:all, :conditions => ['persons = ' + @persons_set])

  render :index
end

The server usually (locally and in heroku) sends a 200 OK response and then just 304 Not modified for subsequent requests as the latest package is not changing.

But when I use my nginx linode hosting i don't see any requests to HTML being responded as 304 while checking the production log - but some json requests do return with 304. Do i need any special configuration for sending 304 responses?