0

before I start, I'm a developer, not a sysadmin (but due to size of the company I work for am having to take on this role as well), so apologies if I get anything stupid wrong.

I'm trying to get a number of different instances of our Rails app running on the same server, each with it's own subdomain, eg. test.mydomain.com and sales.mydomain.com as well as serving a static site from mydomain.com and www.mydomain.com.

Unfortunately, it's a Windows server (due to a Windows only 3rd party dependency). We're using Apache.

The setup I have at the moment oh so nearly works (for a while I actually thought it did).

I have two instances of the app running on ports 3000 and 30001, and the following virtual host setup at the end of my httpd.conf:

<VirtualHost *:80>
       ServerName mydomain.com
       ServerAlias www.mydomain.com
       DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/website"
</VirtualHost>
<VirtualHost *:80>
       ServerName test.mydomain.com
       ServerAlias test.mydomain.com
       ProxyPass / http://localhost:3000/
       ProxyPassReverse / http://localhost:3000/
       ProxyPreserveHost On
</VirtualHost>
<VirtualHost *:80>
       ServerName sales.mydomain.com
       ServerAlias sales.mydomain.com
       ProxyPass / http://localhost:3001/
       ProxyPassReverse / http://localhost:3001/
       ProxyPreserveHost On
</VirtualHost>

With this setup the static website works and I can reach both rails apps by going to their respective domains.

However, certain requests in each of the Rails apps do not work. I get an error like the following:

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /posts/4eaad77ec5b0d6569a3000054.

Reason: Error reading from remote server

It's always the same URLs, and although I haven't been able to work out a pattern this (wild guess) sort of suggests to me it might be something to do with URL rewriting? Honestly haven't a clue.

Some examples of some urls that work are:

http://sales.mydomain.com/people
http://sales.mydomain.com/people/4eabd77cc4d0e709f8000034/edit

Some examples of some urls that don't work are:

http://sales.mydomain.com/people/4eabd77cc4d0e709f8000034
http://sales.mydomain.com/posts/new?person_id=4eabd77cc4d0e709f8000034

Thanks in advance for your help - I appreciate it.

1 Answer 1

0

The proxy server received an invalid response from an upstream server.

This is your Rails framework emitting an error. Check its logs for that error.

Also, remove the redundant ServerAlias directives from the Rails proxies.

1
  • Thanks adaptr - that was the issue. For some reason the server I've been using to try to get Rails working as a Windows service - thin - was causing errors that don't occur using WEBrick, which I've been using for development.
    – Russell
    Nov 10, 2011 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .