views:

161

answers:

2

I have a rails application which is still showing the cachebusting numeric string at the end of the URL for static mode, even though I have put it into the production environment. Can someone tell me what config option I need to set to prevent this behaviour

+3  A: 

That file isn't there to break the cache during day-to-day operations. At least in theory, proxy servers are allowed to cache HTTP GET requests (as long the parameters remain the same).

Instead, that number is there to allow you to smoothly upgrade your CSS and JavaScript files from one version to the next. As I understand it, it's supposed to remain on in production mode. The numbers should only change when the timestamps on your files change.

Are you seeing common proxy servers that completely fail to cache any HTTP GET request with a single parameter?

emk
+1  A: 

To disable the ?timestamp cache busting in production add this to your config/environments/production.rb

ENV['RAILS_ASSET_ID'] = ''

If you want to dig deeper into what this does, check out asset_tag_helper.rb in the ActionPack gem, line 527 (ish)

Dave Cheney