bust_rails_etags
bust_rails_etags copied to clipboard
Development Mode
We want to be able to turn off etags in dev env, but removing ConditionalGet or Etag from the Rack stack does not do it. As this issue points out (https://github.com/rails/rails/issues/3583) they don't consider a feature they should support.
I felt the next best thing was to put this feature in this gem. I forked it and tried implementing it but couldn't get user initializers running before this gem gets inserted into the stack.
What are your thoughts on being able to disable etags in dev environment?
I was hitting the same issue. Since Rails isn't supporting disabling conditional gets in development, I disabled my cache in Chrome to work around it. You can disable it from the web inspector settings.
I was experiencing the exact same issue in a Rails 4 app and created a Rack middleware filter to bust the cache. Just add it to lib and then include the filter in development.rb
# lib/cache_buster.rb
class CacheBuster
def initialize(app)
@app = app
end
def call(env)
env['HTTP_IF_MODIFIED_SINCE'] = ''
env['HTTP_IF_NONE_MATCH'] = ''
@app.call(env)
end
end
# config/environments/development.rb
Rails.application.configure do
...
config.middleware.use 'CacheBuster'
...
end