Hi Eddie,

Here it goes:

.- Environment -> An apache web server configured with mod_proxy and
SSI, running in port 80. Several orion instances with applications
running in other ports.
.- in httpd.conf ->
...
<VirtualHost _default_:80>
    ProxyVia On
    # Proxy configuration for the different applications

    # Application X
    ProxyPass /nameX http://hostx.com:portX/nameX
    ProxyPassReverse /nameX http://hostx.com:portX/nameX

    # Application Y
    ProxyPass /nameY http://hostx.com:portY/nameY
    ProxyPassReverse /nameY http://hostx.com:portY/nameY

    # Error configuration for the "Cannot establish connection case"
    ErrorDocument 502 /SSIErrorHandler.shtml
</VirtualHost>
...
.- Then the SSIErrorHandler.shtml looks like ->
<!-- Define application paths -->
<!-- Define the path for application X -->
<!--#set var="appX" value="/^\/nameX/" -->
<!-- Define the path for application Y -->
<!--#set var="appY" value="/^\/nameY/" -->
...
<!-- 
     Check which was the redirected path and include the appropriate
     error page
-->
<!-- If the original url was from application X -->
<!--#if expr="$REDIRECT_URL=$appX" -->
        <!-- Include the "app X is not running, sorry" error page -->
        <!--#include file="localApacheDirX/index.html" -->
<!-- If the original url was from application Y -->
<!--#elif expr="$REDIRECT_URL=$appY" -->
        <!-- Include the "app Y is not running, sorry" error page -->
        <!--#include file="localApacheDirY/index.html" -->
<!-- Error in an application with no specific message defined -->
<!--#else -->
        <!-- Include the "this app is not running, sorry" error page -->
        <!--#include file="localApacheDirCommon/index.html" -->
<!--#endif -->

And that's pretty much all. Just some catches:
.- In the Error pages, ALL the links have to be absolute and start with
a different name than the proxied path. Otherwise you get an infinite
loop between the proxied page and the error page. So make sure that
nameX and localApacheDirX are ALWAYS different and that all links in
localApacheDirX/index.html start with /localApacheDirX or http://.
.- If inside the applications you want to get the real remote IP instead
of the proxy one, then you can use, for example, the mod_proxy patch
written by Bjoern Hansen which includes the original IP in an http
header (X-Forwarded-For). We used it because we needed to implement IP
based security restrictions, which are not defined in the JSDK spec. We
also used this IP based security restrictions to prevent acces to the
applications by-passing the proxy, which is very important with SSL
protected applications.
.- It also works with ssl.
.- To improve performance, you can also use the apache proxy as
proxy-cache, to get the static content faster, but then be careful not
to allow it to cache the dynamic pages you don't want to be cached. And
make sure you have enough disk space ;).
.- We haven't specified and ErrorDocument directive for the code 500
(internal server error) because we wanted to be able to see this kind of
messages, but you can put it later on to show more graceful messages.
.- We use SSI to define the error hanlding page, but you could use a JSP
if you wished. We just did it to have a light weight proxy with no
special add ons.

I hope it helps,
D.




Eddie wrote:
> 
> Daniel,
> 
> The way you do this with Apache sounds very nice.
> I like to know how you configure Apache to redirect to another page when
> something goes wrong.
> Could you submit a little example please ?
> 
> Eddie
> 
> ----- Original Message -----
> From: "Daniel López" <[EMAIL PROTECTED]>
> To: "Orion-Interest" <[EMAIL PROTECTED]>
> Sent: Monday, November 12, 2001 2:23 PM
> Subject: Re: Monitoring web apps
> 
> > Hi David,
> >
> > We don't have a sophisticated system, but it works well for us. What we
> > do is put an Apache web server, acting as a proxy, in front of the orion
> > server. Then, in the proxy configuration you can specify a redirect page
> > in case something goes wrong, and we use it to redirect to a SSI script
> > that determines which application is down and which page should be shown
> > as an error message. This way you show automatically an error message,
> > just by shutting down orion or by returning a 500 code from your
> > application.
> > I hope it helps,
> > D.
> >
> >
> > David Pérez Villanueva wrote:
> > >
> > > Hi!
> > >
> > > We have several applications running  in  an Orion web server. Our
> > > server is allocated in a hosting corporation. They have a program that
> > > queries our PCs with an url , calling us if there is the word 'error'
> > > (or similar) in response.
> > >
> > > What is the problem? We need something that will check our applications
> > > and will build a html page (or plain text, or anything) with the check
> > > result. Does anybody know any good software to do this? (We have two
> > > PCs: one with Windows 2000 server and  another with Linux).
> > >
> > > Thankyou for your support.
> >
> >

Reply via email to