On Aug 7, 6:49 pm, Perry Smith
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
wrote:> I''m using the latest Firefox and firebug with Rails 2.3.11 (and
Ruby
> 1.9.1).
>
> I see my javascript assets have the last modified date, such as:
>
> javascripts/prototype.js?123456789
>
> which has been the case for a while. What I just noticed is that
> Firefox (according to Firebug) is fetching this for each request. This
> is for a Rails server running in "production" mode. The
browser''s
> caching settings are normal (true for things like
> browser.cache.disk.enable and browser.cache.memory.eable).
>
> With my super small internet connection, pulling over prototype,
> scriptaculous, and all its friends is a significant hit -- plus, it just
> doesn''t make any sense for it to do it every time.
>
> The underlying environment is Apache and Thin (both relatively recent).
> It seems like either the browser should not attempt to fetch it at all
> (which it tends to do if the ?123456789 isn''t there) or the server
> should be returning 304 (not modified).
>
> Is this normal? What options do I have to change this?
You''re actually getting a 200 request back with the full file?
If you want the browser not to bother even fetching the file then you
need to set headers saying that content can be cached.
Something like
<Location /javascripts>
ExpiresActive on
ExpiresDefault "access plus 21 days"
</Location>
should tell browsers that they can cache stuff from javascripts for up
to 21 days.
For stuff like prototype, scriptaculous etc you might want to consider
using the copies hosted by ( http://code.google.com/apis/libraries/ ).
That way those files come from google''s network rather than yours and
they take care of setting all the right caching headers (as well as
having a cdn that is spread worldwide)
Fred
Fred>
> Thank you,
> pedz
>
> --
> Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.