Mongrel proxied through Apache won't serve images

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/

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:

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.)”

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

2006/8/10, David S. [email protected]:

browser window. The Apache logs seem to indicate that the image is http

[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Michael S. [email protected]

www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium

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.

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

http://mongrel.rubyforge.org/
http://www.railsmachine.com/ – Need Mongrel support?

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) or are you using
vhosts ( myapp.mydomain.com/ ) ?

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

http://mongrel.rubyforge.org/
http://www.railsmachine.com/ – Need Mongrel support?