# Filter access to static content

**URL:** <https://www.ruby-forum.com/t/filter-access-to-static-content/184882>\
**Category:** Rails\
**Created:** [March 9, 2010, 9:20pm UTC](https://www.ruby-forum.com/t/filter-access-to-static-content/184882 "2010-03-09T21:20:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geoffroy\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f17d59/32.png) [@Geoffroy\_G](https://www.ruby-forum.com/u/Geoffroy_G)\
**Post date:** [March 9, 2010, 9:20pm UTC](https://www.ruby-forum.com/t/filter-access-to-static-content/184882/1 "2010-03-09T21:20:12Z")

</div>

How can I filter access to static content (images, movies, pdf, …).  
I’m familiar with filtering access to parts of a website, but how can  
I manage to filter access to static files (uploaded images,…)?

Greetz

Geoffroy

---

<div class="post-metadata">

**Author:** ![Geoffroy\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f17d59/32.png) [@Geoffroy\_G](https://www.ruby-forum.com/u/Geoffroy_G)\
**Post date:** [March 9, 2010, 10:19pm UTC](https://www.ruby-forum.com/t/filter-access-to-static-content/184882/2 "2010-03-09T22:19:09Z")

</div>

Geoffroy G. wrote:

> How can I filter access to static content (images, movies, pdf, …).  
> I’m familiar with filtering access to parts of a website, but how can  
> I manage to filter access to static files (uploaded images,…)?

Apache configuration or .htaccess file?

This isn’t really relative to Rails. Requests for static content are  
generally served by the front end web server (Apache, Nginx, etc.) and  
never hit your Rails application.

---

<div class="post-metadata">

**Author:** ![Geoffroy\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f17d59/32.png) [@Geoffroy\_G](https://www.ruby-forum.com/u/Geoffroy_G)\
**Post date:** [March 9, 2010, 11:26pm UTC](https://www.ruby-forum.com/t/filter-access-to-static-content/184882/3 "2010-03-09T23:26:02Z")

</div>

That’s just what I’m asking, how to let Rails handle some static  
content.  
An example of what I mean : Someone upload a picture he wants to be  
the only one to see even if someone else know the url of the picture.  
Should there be a controller dedicated to filter and return the  
pictures (with something like sendfile)
