Re: [maillist] Immer noch Apache ;-)

Klaus Muth (muth@hagos.de)
Wed, 01 Sep 1999 14:27:10 +0200

THOMAS_HAGEDORN@Non-HP-Germany-om2.om.hp.com wrote:

> gibt es eine Möglichkeit, dem Apache beizubringen, einen request auf einen
> bestimmten Port einem bestimmten virtuellen Host zuzuordnen
> _ohne_ dass ich im Browser den Port angeben muss ?
mod_rewrite sollte das koennen, lies mal
http://www.engelschall.com/pw/apache/rewriteguide/
durch, hier ein kleiner Auszug:
--------------------
Redirect Failing URLs To Other Webserver

Problem Description:

A typical FAQ about URL rewriting is how to redirect failing requests on
webserver A to webserver B. Usually this is done via ErrorDocument CGI-scripts
in Perl, but there is also a mod_rewrite solution. But notice that this is
less performant than using a ErrorDocument CGI-script!

Problem Solution:

The first solution has the best performance but less flexibility and is less
error safe:

RewriteEngine on
RewriteCond /your/docroot/%{REQUEST_FILENAME} !-f
RewriteRule ^(.+) http://webserverB.dom/$1

The problem here is that this will only work for pages inside the DocumentRoot.
While you can add more Conditions (for instance to also handle homedirs, etc.)
there is better variant:

RewriteEngine on
RewriteCond %{REQUEST_URI} !-U
RewriteRule ^(.+) http://webserverB.dom/$1

This uses the URL look-ahead feature of mod_rewrite. The result is that this
will work for all types of URLs and is a safe way. But it does a performance
impact on the webserver, because for every request there is one more internal
subrequest. So, if your webserver runs on a powerful CPU, use this one. If
it is a slow machine, use the first approach or better a ErrorDocument CGI-script.
------------------
Hier waere dann http://webserverB.dom/$1 durch http://<lokaler server>:<Port>/$1
angebracht.

klaus

-- 
mit freundlichen Gruessen,
Klaus Muth
 
HAGOS eG                 Industriestr. 62       fon: (+49) 711 78805-86
EDV-Programmierung       D-70565 Stuttgart      fax: (+49) 711 78805-99
http://www.hagos.de      Germany                mailto:muth@hagos.de
-----------------------------------------------------------------------
Alle  heissen  hier  Klaus,   nur  nicht  Norbert,  der  heisst  Ernst!