Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 *:80>
       ServerName test.mydomain.com
       ServerAlias test.mydomain.com
       ProxyPass / http://localhost:3000/
       ProxyPassReverse / http://localhost:3000/
       ProxyPreserveHost On
<VirtualHost *:80>
       ServerName sales.mydomain.com
       ServerAlias sales.mydomain.com
       ProxyPass / http://localhost:3001/
       ProxyPassReverse / http://localhost:3001/
       ProxyPreserveHost On

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:


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


Thanks in advance for your help - I appreciate it.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
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 '11 at 15:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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