Just a quick note: I'm pretty new with Apache and my local network may be a bit screwy. I may be completely off-base.

I recently setup an internal network Ruby application running on a virtual host in Apache2. The IP address will immediately try to resolve the "ServerName" attribute, which isn't a fully-qualified domain name.

Everytime I try to access the application by IP it automatically redirects to the invalid URL. Adding a DNS record for the invalid URL to forward back to this server poses another problem as I'm learning to hate Windows DNS Server.

Is it possible to access this virtualhost via the local IP address?


Apache will not redirect without a directive telling it to do so; it will either answer with a domain that matches a ServerName, or will answer with the site on that port that loads first. If none of those are configured to redirect (probably not in your situation), then Apache won't do it.

More likely the ruby application itself has a DNS name configured that it's attached to, and is sending redirects to try to get clients to use that name.

But, if you can't find where the redirect is coming from, setting a static entry in your system's hosts file is an option for a workaround.

  • I added a record to the host file for the URL the application is configured to use: FOO.BAR While a ping test will resolve, a computer on my network still redirects to the wrong URL. I will continue to look for the source of the redirection in the application. Mar 25 '11 at 19:33
  • @robusto If you configure a hosts entry for the URL that it's redirecting to, does it work? Mar 25 '11 at 19:54
  • A hosts entry on my local machine redirects to the application no problem. Mar 25 '11 at 20:25

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.