# Stop outside access to directory

**URL:** <https://www.ruby-forum.com/t/stop-outside-access-to-directory/177889>\
**Category:** Rails\
**Created:** [October 26, 2009, 11:16am UTC](https://www.ruby-forum.com/t/stop-outside-access-to-directory/177889 "2009-10-26T11:16:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [October 26, 2009, 11:16am UTC](https://www.ruby-forum.com/t/stop-outside-access-to-directory/177889/1 "2009-10-26T11:16:16Z")

</div>

How could I stop access to a directory from the outside, for example a  
dir with images, and only allow it via the Rails app?

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [October 26, 2009, 11:38am UTC](https://www.ruby-forum.com/t/stop-outside-access-to-directory/177889/2 "2009-10-26T11:38:02Z")

</div>

Hi PÃ¥l BergstrÃ¶m

```
 If you mean directory inside a rails application, for example 

```

public/images, then it can be accessed through the application only

Sijo

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [October 26, 2009, 12:05pm UTC](https://www.ruby-forum.com/t/stop-outside-access-to-directory/177889/3 "2009-10-26T12:05:32Z")

</div>

Sijo k g wrote:

> Hi PÃ¥l BergstrÃ¶m
> 
> ```
> If you mean directory inside a rails application, for example 
> 
> ```
> 
> public/images, then it can be accessed through the application only
> 
> Sijo

Great. Thanks.

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [October 26, 2009, 12:18pm UTC](https://www.ruby-forum.com/t/stop-outside-access-to-directory/177889/4 "2009-10-26T12:18:54Z")

</div>

On Oct 26, 10:16 am, Pål Bergström [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> How could I stop access to a directory from the outside, for example a  
> dir with images, and only allow it via the Rails app?

If you don’t want your webserver to just serve up the file then don’t  
put the file inside your document root (ie don’t put it in your app’s  
public folder).

Fred
