0

I recently released a Rails 3.1 upgrade of my webapp. I power this app on an Unbuntu 10.04 VPS with Thin on the backend, Nginx on the front. To make my app work with the new Rails asset pipeline I added the following entry to my Nginx config file:

  location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ {
        access_log off;
        gzip_static on; # to serve pre-gzipped version

        expires max;
        add_header Cache-Control public;

        # Some browsers still send conditional-GET requests if there's a
        # Last-Modified header or an ETag header even if they haven't
        # reached the expiry date sent in the Expires header.
        add_header Last-Modified "";
        add_header ETag "";
        break;
    }

That more or less come straight from the guide, and it works. However, now I'm noticing in my Thin logs entries like the following:

cache: [GET /] miss
cache: [GET /designs/victoria/images/gallery-3-zoom.png] miss, store
cache: [GET /blank.html] stale, invalid, store
cache: [GET /blank.html] stale, invalid, store
cache: [GET /robots.txt] stale, invalid, store
cache: [GET /parties/new] miss

There are a lot of these. Most are for /blank.html. Any asset requests are for un-pipelined assets. Some are URLs straight from my routes file. My questions:

  • What are these "cache:" entries? I have never explicitly configured caching on this app.
  • If my setup is misconfigured how should I correct?
  • Why does blank.html get so many requests (what is blank.html?)?

Any insight is appreciated! Thank you.

Chris
  • 123
  • 1
  • 8

1 Answers1

0

The "cache:" entries seem to be coming from Rack::Cache, which is enabled by Rails in 3.1 when the asset pipeline is turned on. This is a good thing as it does HTTP caching via http headers. By default Rack::Cache has its verbose option enabled, so it does all trace logging to STDERR, which is why it's showing up in my previously not-noisy Thin logs.

The blank.html seems to be part of a IE6 fix, to make the browser show iframe backgrounds transparently, when being hovered. I have no idea why it gets requested with such frequency but the file is in Rails by default and has always been there.

All that said, my app seems to be healthy and in good shape.

Chris
  • 123
  • 1
  • 8