Welcome Guest | Login

Adding an Expires header with apache for Rails

As anyone had any success using Rails and handling expires header in Apache?

i've followed this tutorial:http://pennysmalls.com/2007/10/19/adding-an-expires-header-with-apache-for-rails/

but I didn't notice any changes on the requests.

2008-03-06 10:02 AM

Please post a ticket to support team with your domain name so that they can help you out in making the necessary changes in vhost entries.

2008-03-07 01:45 AM

I am trying to add the expires headers to the static content of my pages. Through reading a few different helps on this and other sites, I've come across some things that I think I understand and other things I don't think I understand. Going off the example referenced above (the pennysmalls.com example), I should use something similar to the following:

# add something we can do a directory match on
RewriteCond %{QUERY_STRING} ^[0-9]{10}$
RewriteRule ^(.*)$ /add_expires_header%{REQUEST_URI} [QSA]

# the add_expires_header directory is just a symlink to public
<Directory "/path/to/myapp/public/add_expires_header">
 ExpiresActive On
 ExpiresDefault "access plus 6 months"
</Directory>

The author speaks of putting all this in the httpd.conf file. I do not know where that is in the hosting rails structure. It seems as though I should put the first half (and I initially thought the second half) of this code in the myapp/public/.htaccess file. I can parse it out in my mind and understand what it is doing, however, it breaks my server (and yes, I did create the symbolic link to the add_expires_header folder properly). I take out the second half and then the server is back up again. So I'm thinking that the second half must belong somewhere else, unless there is something else I'm missing or doing wrong. Is there a httpd.conf file I should know about? What I do understand (think that I understand anyway) is the code and what it is supposed to be doing. What I don't understand is where I am supposed to put the code for it to work together properly (in another thread in mentions a modules/mod_expires.so file - I don't know anything about that file either). Any suggestions?

2008-11-19 11:47 AM

Hi Homerun,

You have to contact the support team with the domain name to include "Expires header" in the Apache configuration file. Please note that cPanel users don't have the privilege to edit the Apache configuration file.

2008-11-19 05:36 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.