# Rails, Mongrel & Pound / SSL and Browser Caching

**URL:** <https://www.ruby-forum.com/t/rails-mongrel-pound-ssl-and-browser-caching/111572>\
**Category:** Rails\
**Created:** [August 8, 2007, 6:37pm UTC](https://www.ruby-forum.com/t/rails-mongrel-pound-ssl-and-browser-caching/111572 "2007-08-08T18:37:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonlog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/db5fbb/32.png) [@jonlog](https://www.ruby-forum.com/u/jonlog)\
**Post date:** [August 8, 2007, 6:37pm UTC](https://www.ruby-forum.com/t/rails-mongrel-pound-ssl-and-browser-caching/111572/1 "2007-08-08T18:37:10Z")

</div>

This may not exactly be a Rails question, but I think this is the most  
likely place to find someone with an answer.

We’ve got a Rails site that uses several mongrels and pound as the  
balancer between them. The site uses SSL encryption.

The problem is, with the SSL, browsers aren’t caching anything… so  
every page view is reloading all the /public/stylesheets and  
/public/javascripts. There’s a very noticeable speed difference when we  
access the site over a non-encrypted connection. According to DHH’s  
comment here… (  
[http://www.chadfowler.com/2007/2/18/edge-rails-goody-distributed-asset-hosts](http://www.chadfowler.com/2007/2/18/edge-rails-goody-distributed-asset-hosts)  
) “Browsers actually cache assets just fine on SSL if you set the proper  
headers (which most web servers will do by default).”

Well, I’ve looked at the response headers in my browser, and they’re  
definitely not being set by default. There’s no difference between the  
headers for the same file across http and https (neither of which have  
anything like Cache-Control or Expires headers). My understanding is  
that, without these headers, browsers will cache non-encrypted stuff for  
a day or so (depending on the browser), but will _not_ cache https  
retrieved files.

So, my question is, where/how can I best set the response headers so  
that the browsers know they can safely cache stylesheets, javascripts,  
and images from this app, but not the controller actions. Is this a  
mongrel setting, pound setting, something I can set in environemnt.rb?  
I’ve scoured the google and I’m not finding any real answers, only hints  
(like the one above) that there are answers out there, somewhere.

–  
[http://www.5valleys.com/](http://www.5valleys.com/)
