How can I free images from Rails caching?

I implemented this solution to prevent browser page caching based on the question How to prevent browser page caching in Rails :

def set_cache_buster response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" response.headers["Pragma"] = "no-cache" response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT" end 

Although this certainly works, it looks a bit like killing an ant sledgehammer; everything prevents caching, including images (for example, a hamburger icon or other small images). When navigating from page to page, this leads to unsightly flashes of blank content while these images reload.

Is there a way to prevent shared caching but free up certain resources?

+7
caching ruby-on-rails
source share
1 answer

Sorry for the missing tags, but as I see it, nginx might be the perfect answer - just put the content (images / css / etc) with nginx and pass all the other requests to the backend (ruby)

+1
source share

All Articles