Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to point 2 URLs to the same rails app. Seems like it would be easy but it's not working!

The existing setup looks like this:

<VirtualHost *:80>
        DocumentRoot /home/some/path
        RewriteEngine On
        ProxyRequests Off
        ProxyPass / http://localhost:3000/
        ProxyPassReverse / http://localhost:3000/
        ProxyPreserveHost on
        AccessFileName .htaccess

         <Proxy *>
          Order deny,allow
          Allow from all

I copied/pasted this and modified servername to the new servername (let's say ""). When I try going to, though, I get the default Fedora Test page. Apache error log shows "Directory index forbidden by Options directive" and rails logs aren't showing that the request is hitting rails.

The one caveat that may or may not be related is this. The second domain (in this case "") is a "leased" URL. Meaning. I don't actually own it and it's leased to me by the owner. When I ping the domain, the IP that's returned is actually different from my server.

But request to this domain ARE hitting my server (as shown by apache access logs). So it seems that requests to this domain are being proxied by their servers.

Could this proxying affect how Apache is handling the request?

share|improve this question
up vote 2 down vote accepted

It does look like they're proxying. You can verify this by hitting the site and looking at the source IP -- if it's yours, then they're not proxying, they're doing something really weird, otherwise the source IP should be that of their proxy box. I would imagine that their proxying is probably doing all sorts of unpleasant things to the setup -- if the Host header being sent by their proxy server isn't what you're expecting, for instance, then that'll naturally cause problems. I always log the provided vhost name in my "default vhost" logs for this very reason -- it shows me what people might be hitting me from.

When it comes to the setup, I'd strongly recommend getting them to change the DNS to point to your server directly. That you're "leasing" the domain is irrelevant; DNS can still be managed properly. The only time proxying makes sense is if they're only redirecting part of the site to you, and serving other content on the same domain locally. For your Apache configuration, why are you setting up a whole separate vhost instead of just adding the second domain name as a ServerAlias on the existing vhost?

share|improve this answer
You were right. I looked at the headers of the actual requests and though the IP showing was mine, the Host header was being modified. The Host was set to the IP address instead of the actual host being requested. As a result, I had to map a VirtualHost to this IP address (actually this was in AWS so I had to map it to the internal IP address). Proxied requests suck. – freshfunk Aug 11 '11 at 21:26
@freshfunk As a better alternative to that workaround, tell them to get their act together and set the ProxyPreserveHost directive. – Shane Madden Aug 11 '11 at 21:55
Thanks for the tip Shane. I realized how much the IP issue is giving me a headache (since I have other VirtualHosts on this machine). – freshfunk Aug 12 '11 at 4:31

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.