# Are images automatically cached? if not, put it in rails?

**URL:** <https://www.ruby-forum.com/t/are-images-automatically-cached-if-not-put-it-in-rails/105639>\
**Category:** Rails\
**Created:** [May 31, 2007, 10:39pm UTC](https://www.ruby-forum.com/t/are-images-automatically-cached-if-not-put-it-in-rails/105639 "2007-05-31T22:39:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mixplate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mixplate](https://www.ruby-forum.com/u/mixplate)\
**Post date:** [May 31, 2007, 10:39pm UTC](https://www.ruby-forum.com/t/are-images-automatically-cached-if-not-put-it-in-rails/105639/1 "2007-05-31T22:39:46Z")

</div>

Hi,  
I came across this article on yahoo

[http://developer.yahoo.net/blog/archives/2007/05/high\_performanc\_2.html](http://developer.yahoo.net/blog/archives/2007/05/high_performanc_2.html)

how do i implement this in a rails app that serves up images?

thanks/

---

<div class="post-metadata">

**Author:** ![mixplate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mixplate](https://www.ruby-forum.com/u/mixplate)\
**Post date:** [May 31, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/are-images-automatically-cached-if-not-put-it-in-rails/105639/2 "2007-05-31T22:43:13Z")

</div>

disreggard, just put it in the .htaccess and all is good.

mixplate wrote:

> Hi,  
> I came across this article on yahoo
> 
> [http://developer.yahoo.net/blog/archives/2007/05/high\_performanc\_2.html](http://developer.yahoo.net/blog/archives/2007/05/high_performanc_2.html)
> 
> how do i implement this in a rails app that serves up images?
> 
> thanks/

---

<div class="post-metadata">

**Author:** ![mixplate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mixplate](https://www.ruby-forum.com/u/mixplate)\
**Post date:** [May 31, 2007, 11:29pm UTC](https://www.ruby-forum.com/t/are-images-automatically-cached-if-not-put-it-in-rails/105639/3 "2007-05-31T23:29:16Z")

</div>

On 5/31/07, mixplate [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,  
> I came across this article on yahoo
> 
> [http://developer.yahoo.net/blog/archives/2007/05/high\_performanc\_2.html](http://developer.yahoo.net/blog/archives/2007/05/high_performanc_2.html)
> 
> how do i implement this in a rails app that serves up images?
> 
> thanks/

If you’re talking about static images, you can do this in your web  
server (apache/lighttpd/nginx/etc). If you’re talking about dynamic  
images served by rails directly, you can set your own expires headers:

[http://rails.rubyonrails.org/classes/ActionController/Base.html#M000272](http://rails.rubyonrails.org/classes/ActionController/Base.html#M000272)

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)
