Topic: Removing Cache-Control

Hello Rails World!

I'm pretty new to all of this, so my question might be simple/naive.  I just put an app up on an Apache2.2 server

Server: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch1 mod_ruby/1.2.6 Ruby/1.8.5(2006-08-25)

and it runs great and all, except for

Cache-Control: no-cache

in the headers.  In the Apache virtual host config file is

SetEnv RAILS_ENV production

and in config/environments/production.rb

config.cache_classes = true
config.action_controller.perform_caching = true

I have verified that the app is, in fact, running in production mode by testing database connectivity.

The problem is it seems that images referenced in my layout are not being cached by browsers and with every page change are being downloaded again. While I'm not an HTTP guru, my suspicion is Cache-Control: no-cache is preventing the images from being cached. Does this seem plausible? If so, how might I change this behavior and let browswers cache images?

Thanks for any and all help!

Peace,
Phillip

Re: Removing Cache-Control

If it's the images that aren't getting cached then this is purely an Apache issue.  Apache only even runs Rails when it's a rails page being requested.

I'm not sure what your apache configuration looks like but if you google "apache cache-control" you might be able to find some good help.

Good luck!

Re: Removing Cache-Control

Hi danger.

Thanks for the reply.  So you do not think it's Rails putting the Cache-Control: no-cache in the response header?  You believe it's Apache? Would you happen to know an easy way to test this theory?

Thanks,
Phillip

Re: Removing Cache-Control

You could test by issuing requests to webrick and/or mongrel.

BrewControl.com - Brewery and Brewpub management powered by RoR

Re: Removing Cache-Control

Hello all,

After further research, I have learned that the major factor in performance was running Rails under Apache+mod_ruby.  Gack!  The other factor was in development mode, the CSS and JS files are sent with each request.  In production they are not.  In neither case were the images being retransmitted.  I did some tests comparing Apache with LiteSpeed, and wow! is there a difference.  I don't have hard numbers to back this claim up, but based on a user's perception (mine) and doing some simple timings, LiteSpeed was easily 2-3 times faster on the same application.

Anyway, thanks for the contributions.  I have other questions now, so I'm going to start a new thread.

Peace,
Phillip