Enable image caching in development mode in Rails 3.1

倾然丶 夕夏残阳落幕 提交于 2019-12-05 10:51:59

http://code.google.com/p/chromium/issues/detail?id=102706

This seems to be a documented issue with chrome. I'm suffering from the same problem: Adding or removing a CSS class that references an image will flash or resize while the image request (which will always return a 304 not modified) is underway.

Mitch Kett

The only way I've seen to manipulate the Cache-Control header for assets is by configuring static assets with:

config.serve_static_assets = true

config.static_cache_control = "public, max-age=3600"

Sprockets is either going to send caching headers or force revalidation (see the source).

I can see no publicly available options to change this behavior.

To modify this I think you will have to monkey patch Sprockets.

Possibly of greater interest is why Chrome is behaving in that way?

You dont need to compile assets into public/assets and remove *js *css to cache images

you can cache image in rack, https://github.com/mvj3/rack_image_assets_cache_control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!