Thursday, October 18, 2012

Re: [Rails] Why is max-age in config.static_cache_control being ignored?

I solved my problem by running
RAILS_ENV=production bundle exec rake assets:precompile

It appears that the setting for config.static_cache_control is being lazily cached.

If I do the following, I get back max-age=1000 in the response header

config.static_cache_control = "public, max-age=1000"
precompile assets
start webrick
visit webpage

However if I do the following I don't get back max-age=1000, instead I get max-age=2000

config.static_cache_control = "public, max-age=1000"
precompile assets
start webrick
close webrick
config.static_cache_control = "public, max-age=2000"
start webrick
visit webpage

Can someone explain to me how this is possible and give a model for how config.static_cache_control is being saved?

On Thursday, October 18, 2012 12:14:44 AM UTC-7, Jordon Bedwell wrote:
On Wed, Oct 17, 2012 at 9:15 PM, Cary Cherng <cch...@gmail.com> wrote:
> In config/environments/production.rb I have set
>
> config.serve_static_assets = true
> config.static_cache_control = "public, max-age=1000"

If I remember right, anything served from /app/assets is not
considered static to the system because it requires more to route it,
but anything in /public should be considered a static asset and will
fall under your cache control.  Since I normally handle all my headers
via Apache or Nginx I don't remember if this is entirely the case
anymore but again if I remember right everything again in /app/assets
is considered compiled on the fly unless you compile it to /public.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/hs5WgJ3whkgJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate