Forum: Ruby on Rails Just how the hell do you set Cache-Control max-age?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
40920c2420f2ed4841ff4ed2fc34c99f?d=identicon&s=25 Petr Janda (petrjanda)
on 2009-03-23 13:49
Hi all,

Ive been googling for couple of hours and I just cant figure it out. I
want to set the max-age value to 300 for the WHOLE application,
regardless of development or production mode.

Is there anyone that knows?

Petr
992f6dd317a9b164e1efc5b674623f38?d=identicon&s=25 Michael Graff (Guest)
on 2009-03-23 17:31
(Received via mailing list)
I would probably set this in the web front-end (apache, etc)  This is
where I do expires stuff.  I have to be careful though since most of
the examples I've seen literally say to set it globally, but Rails
uses the public directory for caching as well.

For max age, I'd consider having Apache set it, so it will also be set
for cached files, if you use any caching.

--Michael


On Mon, Mar 23, 2009 at 7:49 AM, Petr Janda
<rails-mailing-list@andreas-s.net> wrote:
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>



--
(Ruby, Rails, Random) blog:  http://skandragon.blogspot.com/
51655eeeedad656fad30717c46852437?d=identicon&s=25 Chris Kottom (Guest)
on 2009-03-25 15:35
(Received via mailing list)
Hi Petr,

Rails provides ActionController#expires_in and
ActionController#expires_now
for doing this on a case-by-case basis, but Michael is right that this
is
something you want to be doing on your HTTP server, not in your
application.
This topic is locked and can not be replied to.