[Mongrel] expires header for .css

Scott Derrick lists at ruby-forum.com
Tue May 6 17:50:51 EDT 2008

Scott Windsor wrote:
> Is your webserver directly talking to users or are you using a proxy?

At this point mongrel is talking directly to the users.   I've been 
looking at nginx but since I'm in a critical phase of development right 
now I didn't want to enter any new services at this time.

> You can do this in mongrel, but generally you can configure your proxy 

Yes I would like to do this in mongrel. Pre recomendation I added this 
to my environmnet.rb

  if defined? Mongrel::DirHandler
    module Mongrel
      class DirHandler
        def send_file_with_expires(req_path, request, response, 
          response.header['Cache-Control'] = 'max-age=315360000'
          response.header['Expires'] = (Time.now + 10.years).rfc2822
          send_file_without_expires(req_path, request, response, 
        alias_method :send_file_without_expires, :send_file
        alias_method :send_file, :send_file_with_expires
 but it doesn't add the expires header to the css file.

thanks for your help in this matter,


Posted via http://www.ruby-forum.com/.

More information about the Mongrel-users mailing list