Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8485867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:46:16+00:00 2026-06-10T20:46:16+00:00

In Rails 3.1 development mode (when using the asset pipeline), images served out of

  • 0

In Rails 3.1 development mode (when using the asset pipeline), images served out of assets/images are served up with the response header “Cache Control: must-revalidate”.

This means that Google Chrome (and seemingly only Chrome) will attempt to re-fetch images numerous times—even during a single page view. This has resulted in screwy issues with all manners of DOM manipulation via JavaScript. To name a few:

  • jQuery UI Draggable sometimes features a dramatic offset from the mouse cursor
  • 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.
  • Attaching or replacing HTML nodes that contain images will trigger more image fetches which will cause the entire tree of nodes underneath them to flash stutter as Chrome waits for the 304 response for each image.

I can completely understand that to be a reasonable thing for a development server to do. I can even understand that Chrome’s refusal to cache the image, even inside a single page view, is perfectly reasonable.

So, is there a way to change the Cache Control header that Rails applies to image responses in development?

Update: as suggested by a couple people, an even more interesting question is why does Chrome attempt to re-fetch the images multiple times within a pageview when no other browsers seem to? (And why isn’t this causing issues for other developers?)

Update x2: I’m not going to submit this as an answer because it’s just a workaround that happens to be sufficient for my purposes, but we were able to get around this issue by precompiling assets and then discarding the precomplied CSS & JS. (This will require sprockets debugging to be turned to false in development.rb.)

rake assets:precompile
cd public/assets
find . -name "*.js*" -exec rm -rf {} \;
find . -name "*.css*" -exec rm -rf {} \;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:46:17+00:00Added an answer on June 10, 2026 at 8:46 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the Rails assets pipeline and a plugin for require.js, I can use CoffeeScript,
I'm using webrick to run my rails app in development mode. The page includes
In my rails app I'm displaying some posts using nested loops. In development mode,
I have a rails application, running in development mode ( with a sqlite database
Every time I change a .coffee file in the development mode, Rails creates a
Consider a basic Rails development pipeline, going from development -> staging -> production. When
What are the difference between three modes in rails like:- In development mode, Rails
I just got started with rails, and when I testing in development mode, I
Once I start coding a rails app, I am by default in development mode.
Trying to test deploy a simple Rails 3.1 app in production mode, using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.