bust_rails_etags icon indicating copy to clipboard operation
bust_rails_etags copied to clipboard

Development Mode

Open RafaelAlba opened this issue 11 years ago • 2 comments

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?

RafaelAlba avatar May 09 '13 17:05 RafaelAlba

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.

limitingfactor avatar May 26 '13 00:05 limitingfactor

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

hahahana avatar Jan 13 '15 00:01 hahahana