# Mongrel proxied through Apache won't serve images

**URL:** <https://www.ruby-forum.com/t/mongrel-proxied-through-apache-wont-serve-images/102089>\
**Category:** Rails\
**Created:** [August 10, 2006, 4:17pm UTC](https://www.ruby-forum.com/t/mongrel-proxied-through-apache-wont-serve-images/102089 "2006-08-10T16:17:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 10, 2006, 4:17pm UTC](https://www.ruby-forum.com/t/mongrel-proxied-through-apache-wont-serve-images/102089/1 "2006-08-10T16:17:23Z")

</div>

I followed the tutorial from Coda Hale[1] on setting up  
Mongrel/Mongrel\_cluster and Apache to move away from my current  
Apache+FastCGI setup.

The mongrels are all working fine, and Apache is proxying all dynamic  
requests through to the cluster using proxy balance.

Strange thing is now, that all my images in public/images aren’t loading  
at all, if I access them directly I just get a URL link to them in the  
browser window. The Apache logs seem to indicate that the image is http  
200 and served to my browser, I am able to access other static files,  
such as css, and it is served correctly by Apache. If I type in an  
incorrect image URL then Apache correctly gives me a 404, so looks like  
it is finding the file, but just not sending it to me correclty. I’ve  
used curl to check that mongrel is serving the dynamic stuff, and apache  
the static stuff and this is all correct. Just the images are causing a  
problem.

Anyone else experienced something like this when setting up  
mod\_proxy\_balancer?

David

[1] -  
[http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/](http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/)

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 10, 2006, 7:04pm UTC](https://www.ruby-forum.com/t/mongrel-proxied-through-apache-wont-serve-images/102089/2 "2006-08-10T19:04:22Z")

</div>

David S. wrote:

> Anyone else experienced something like this when setting up  
> mod\_proxy\_balancer?

I fixed this, it was a problem with Sendfile. Used this link for  
reference:

> **[Garayed.com is for sale | HugeDomains](https://www.hugedomains.com/domain_profile.cfm?d=garayed.com)**
>
> Easy, affordable options for you to obtain the domain you want. Safe and secure shopping.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 10, 2006, 7:15pm UTC](https://www.ruby-forum.com/t/mongrel-proxied-through-apache-wont-serve-images/102089/3 "2006-08-10T19:15:37Z")

</div>

David S. wrote:

> I fixed this, it was a problem with Sendfile.

Think that tutorial was updated to remove sendfile:

“I used to advise installing sendfile, but it doesnâ??t helpâ??Apache serves  
the static content, so the 20%-or-so boost on static files is never  
seenâ??and it can even cause some pretty severe stability issues. So. No  
sendfile, and if youâ??ve got it installed, uninstall it, pronto. (This  
comes straight from Zed, who would know such things.)”

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/mongrel-proxied-through-apache-wont-serve-images/102089/4 "2006-08-15T14:16:25Z")

</div>

something unusual in mongrel.log?  
does it work when you go to your mongrels directly  
([http://localhost:8001](http://localhost:8001))?  
are the files null-sized? what content-length does mongrel return to  
your  
browser?

2006/8/10, David S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> browser window. The Apache logs seem to indicate that the image is http
> 
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Michael S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

[www.stellar-legends.de](http://www.stellar-legends.de) - Weltraum-Browsergame im Alpha-Stadium

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 10, 2006, 7:22pm UTC](https://www.ruby-forum.com/t/mongrel-proxied-through-apache-wont-serve-images/102089/5 "2006-08-10T19:22:41Z")

</div>

David C. wrote:

> David S. wrote:
> 
> > I fixed this, it was a problem with Sendfile.
> 
> Think that tutorial was updated to remove sendfile:

yes it was, but for some reason it was already enabled in my Apache  
(built from source and I definitely didn’t ) and I didn’t realise till I  
bumped the log level up to debug in my error\_log.

Therefore I didn’t realise Sendfile was even there and causing a  
problem, just a heads up to anyone else hitting a similar problem with  
HTTP 206 returned for static content.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 15, 2006, 2:18pm UTC](https://www.ruby-forum.com/t/mongrel-proxied-through-apache-wont-serve-images/102089/6 "2006-08-15T14:18:34Z")

</div>

On Thu, 2006-08-10 at 19:15 +0200, David C. wrote:

> 

Yes, remove sendfile everyone. It doesn’t handle a few key errno style  
errors that are returned from different operating systems. (Hell, who  
needs POSIX anyway?)

–  
Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

[http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)  
[http://www.railsmachine.com/](http://www.railsmachine.com/) – Need Mongrel support?

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 15, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/mongrel-proxied-through-apache-wont-serve-images/102089/7 "2006-08-15T18:45:05Z")

</div>

More information might be helpful here…

Did the applications work correctly behind Apache when running in  
webrick or lighttpd?  
Are you mapping the front-end Apache server to back-end Mongrel apps  
using a path based scheme ([www.mydomain.com/myapp](http://www.mydomain.com/myapp)) or are you using  
vhosts ( [myapp.mydomain.com/](http://myapp.mydomain.com/) ) ?

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/mongrel-proxied-through-apache-wont-serve-images/102089/8 "2006-08-15T14:19:39Z")

</div>

On Thu, 2006-08-10 at 16:17 +0200, David S. wrote:

> 200 and served to my browser, I am able to access other static files,  
> such as css, and it is served correctly by Apache. If I type in an  
> incorrect image URL then Apache correctly gives me a 404, so looks like  
> it is finding the file, but just not sending it to me correclty. I’ve  
> used curl to check that mongrel is serving the dynamic stuff, and apache  
> the static stuff and this is all correct. Just the images are causing a  
> problem.

Turn on mod\_rewrite logging and make sure that it’s working the way you  
expect. Most likely some rewrite rule is messing things up or that  
you’re not actually serving it with apache but instead with mongrel  
(through apache).

–  
Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

[http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)  
[http://www.railsmachine.com/](http://www.railsmachine.com/) – Need Mongrel support?
