David Smalley
2006-Aug-10 14:26 UTC
[Rails] 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/ -- Posted via http://www.ruby-forum.com/.
Michael Siebert
2006-Aug-10 15:43 UTC
[Rails] Mongrel proxied through Apache won''t serve images
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 Smalley <david.smalley@gmail.com>:> > 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/ > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Michael Siebert <info@siebert-wd.de> www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060810/e25acac4/attachment.html
David Smalley
2006-Aug-10 17:06 UTC
[Rails] Re: Mongrel proxied through Apache won''t serve images
David Smalley wrote: <snip>> 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: http://www.garayed.com/apache-configurations/5696-apache-2-2-0-not-serving-js-css-image-files-2.html -- Posted via http://www.ruby-forum.com/.
David C.
2006-Aug-10 17:34 UTC
[Rails] Re: Mongrel proxied through Apache won''t serve images
David Smalley 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.)" -- Posted via http://www.ruby-forum.com/.
David Smalley
2006-Aug-10 17:34 UTC
[Rails] Re: Mongrel proxied through Apache won''t serve images
David C. wrote:> David Smalley 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. -- Posted via http://www.ruby-forum.com/.
Zed Shaw
2006-Aug-12 23:31 UTC
[Rails] Re: Mongrel proxied through Apache won''t serve images
On Thu, 2006-08-10 at 19:15 +0200, David C. wrote:> David Smalley 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.)" >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://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.railsmachine.com/ -- Need Mongrel support?
On Thu, 2006-08-10 at 16:17 +0200, David Smalley wrote:> 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.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://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.railsmachine.com/ -- Need Mongrel support?
Robert Mela
2006-Aug-15 16:42 UTC
[Rails] Mongrel proxied through Apache won''t serve images
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/ ) ? Zed Shaw wrote:> On Thu, 2006-08-10 at 16:17 +0200, David Smalley wrote: > >> 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. >> > > 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). > > >-------------- next part -------------- A non-text attachment was scrubbed... Name: rob.vcf Type: text/x-vcard Size: 116 bytes Desc: not available Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060815/68a52442/rob.vcf
Apparently Analagous Threads
- [WARNING] don''t use ruby-sendfile
- New automated Capistrano setup for Apache2.1+ and mongrel_cluster
- Strange local requests with Apache 2.2, mod_proxy_balancer, and Mongrel 0.3.13.2
- problems with apache 2.2 proxying to mongrel cluster
- [SEC] Mongrel Temporary Fix For cgi.rb 99% CPU DoS Attack