# Rails, lighttpd and the Expires header

**URL:** <https://www.ruby-forum.com/t/rails-lighttpd-and-the-expires-header/162859>\
**Category:** Rails\
**Created:** [March 14, 2009, 5:51pm UTC](https://www.ruby-forum.com/t/rails-lighttpd-and-the-expires-header/162859 "2009-03-14T17:51:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tekhne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/90ced4/32.png) [@tekhne](https://www.ruby-forum.com/u/tekhne)\
**Post date:** [March 14, 2009, 5:51pm UTC](https://www.ruby-forum.com/t/rails-lighttpd-and-the-expires-header/162859/1 "2009-03-14T17:51:02Z")

</div>

I have a controller that serves up images from a different location  
from /public/images/ by using send\_file or send\_data on /media/thumbs/  
38 for example

In lighttpd I have:

expire.url = ( “/media/” =\> “access 10 years”,  
“/stylesheets/” =\> “access 10 years” ,  
“/javascripts/” =\> “access 10 years”,  
“/images/” =\> “access 10 years” )

The correct expires value is being set for /stylesheets/, /  
javascripts/ and /images/ but it is not being set for /media/.

Any idea as to how I might get either:

1. lighttpd to set the expires header
2. rails to set the expires header for send\_data and send\_file

Unless I am doing it completely wrong, in which case so pointers would  
be useful.

Thanks.

---

<div class="post-metadata">

**Author:** ![tekhne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/90ced4/32.png) [@tekhne](https://www.ruby-forum.com/u/tekhne)\
**Post date:** [March 14, 2009, 9:46pm UTC](https://www.ruby-forum.com/t/rails-lighttpd-and-the-expires-header/162859/2 "2009-03-14T21:46:13Z")

</div>

On Sat, Mar 14, 2009 at 6:50 PM, Peter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Â Â Â Â Â Â Â Â “/images/” =\> “access 10 years” Â )
> 
> The correct expires value is being set for /stylesheets/, /  
> javascripts/ and /images/ but it is not being set for /media/.
> 
> Any idea as to how I might get either:
> 
> 1. lighttpd to set the expires header
> 2. rails to set the expires header for send\_data and send\_file

expires\_in 10.years

There are nice screencasts on this subject at  
[http://railslab.newrelic.com/](http://railslab.newrelic.com/)

1\>

> Unless I am doing it completely wrong, in which case so pointers would  
> be useful.
> 
> Thanks.
> 
> >

–  
Kaspars Bankovskis

---

<div class="post-metadata">

**Author:** ![tekhne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/90ced4/32.png) [@tekhne](https://www.ruby-forum.com/u/tekhne)\
**Post date:** [March 15, 2009, 4:07pm UTC](https://www.ruby-forum.com/t/rails-lighttpd-and-the-expires-header/162859/3 "2009-03-15T16:07:17Z")

</div>

Thanks, I will look into that

Thanks
