httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From René Clerc <r...@clerc.nl>
Subject [users@httpd] Apache 1.3 VirtualHost in combo with rewrite
Date Thu, 02 Oct 2003 12:08:58 GMT
Hi all,

I have a problem which, AFAICT, can be solved using VirtualHosts, but
I just haven't yet found out how ;-)

We've built a Tomcat application that needs to be accessible through
Apache (1.3).  If a user accesses, let's say, http://www.foo.com,
Apache redirects the user to the Tomcat application (running on port
8080).  If a user tries to access http://www.bar.com, which resolves
to the same IP address, the user will *not* be redirected, but served
an error page.  In fact, I want this to happen when the user types
anything *but* http://www.foo.com (including the direct IP address).

The proxying and rewriting between Apache and Tomcat works great,
using mod_rewrite and mod_proxy.  It's just these accessibility
demands I recently came up with, that I can't get to work.  I've
tried:

<VirtualHost www.foo.com>
    ServerName www.foo.com
    ErrorDocument 500 /error500.html
    RewriteEngine On
    RewriteCond $1 !error
    RewriteRule (.*) http://localhost:8080/$1 [P]
    ProxyPassReverse / http://localhost:8080/
</VirtualHost>

<VirtualHost _default_:*>
    DocumentRoot /var/www/html
</VirtualHost>

and probably most variations in order, changing _default_ to either the
IP address or www.bar.com, but nothing worked:  currently, no matter
what the user types in, (s)he's always redirected to the Tomcat
application.

Am I on the right track?  Does anybody know how to solve my problem?

Thanks in advance,

-- 
René Clerc                      - (rene@clerc.nl) - PGP: 0x9ACE0AC7

228. If the hero claims he wishes to confess in public or to me
     personally, I will remind him that a notarized deposition will
     serve just as well.

-"Peter Anspach's list of things to do as an Evil Overlord"

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message