5

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
    </Proxy>

    ProxyPass / balancer://application_cluster
</VirtualHost>

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

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

2 Answers2

2

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)

korkman
  • 1,657
  • 2
  • 13
  • 26
0

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.

-d

  • 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! –  Jun 22 '10 at 20:14