I am using the proxy_balancer in Apache2 to proxy requests to a Rails application to my rails server on the port the application is running on. This is how its set up...

Rails Server Mongrel running on port 8000, when accessing the url directly to http://rails_server:8000 the site loads fine

Apache Server Conf file for the site:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName myserver.com
    ServerAlias application.myserver.com

    <Proxy balancer://application_cluster>
            Allow from localhost
            BalancerMember http://ip.to.server:8000 retry=10

    ProxyPass / balancer://application_cluster

The problem I am having is going to http://rails_server:8000 works fine, but going to http://application.myserver.com Loads the right content, but is displaying all the HTML as text and not rendering it as html

  • I miss a ProxyPassReverse / balancer://application_cluster directive. Also, what's the output of curl -I application.myserver.com ? – Iñigo Sep 12 '11 at 11:21

Try adding

ProxyPassReverse / balancer://application_cluster

like Inigo said in his comment. Just below ProxyPass.

(wow just realized I'm over a year late with this post, "unanswered question" it is but I doubt the author ever comes back)

| improve this answer | |

I would check the content type returned by the URLs in question. It sounds like one is passing "text/html" and the other "text/plain" . . . perhaps in your proxy configuration you need to frob some content-type setting.


| improve this answer | |
  • It is giving me a content type of text/plain, but when I use this same method to proxy to Mongrel instances running on the same machine as Apache things work fine, why would this be happening just because it is coming from a different server? – trobrock Jun 22 '10 at 15:05
  • If I set the DefaultType directive in the conf file it shows the html file, but every other file such as css files get the text/html content type. Why is this proxy not detecting the proper content type for the files? – trobrock Jun 22 '10 at 15:18
  • Honestly, I have no experience with this. Just taking a stab that Apache is messing with the content-type. Hopefully someone has a proper solution. Good luck! – dannyman Jun 22 '10 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.