0

I have a Apache 2.2 that hosts a proprietary (commercial) authentication module. That modules looks at every requests and might let them through if they are flagged and "anonymous ok" in the back-end authentication software.

One such anonymous resource is a small gif queried by the load balacer fronting our Apaches, named /lb.gif.

When there is a problem with the authentication software, its module does not take any chances and blocks everything, including our load-balancer beacon file. The load-balancer thinks the site is down and stops sending traffic to it.

I want Apache not to send this particular request to other modules. This kind of works:

RewriteEngine On
RewriteRule ^/lb.gif$ - [R=200]

Seeing this, Apache returns some HTML with a 200 result:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>200 OK</title>
</head><body>
<h1>OK</h1>
<p>The server encountered an unknown error, possibly due to misconfiguration.
Contact the server administrator: [no address given]<p>
More information about this error may be available
in the server error log.</p>
</body></html>

It satisfies the load-balancer, but confuses another tool we are using for monitoring.

Is there a way to tell Apache to stop processing and return immediately a resource, not sending the request further down the chain of modules?

ixe013
  • 1,018
  • 2
  • 10
  • 26

1 Answers1

1

You might argue that the loadbalancer check failing when your authentication module is acting up is exactly what you need...

A work-around I have used in the past is setting up a separate VirtualHost in the Apache configuration, where you can disable authentication, and assuming that the loadbalancer http client sends a HTTP 1.1 Host header, validate the web server node uptime by polling that VirtualHost instead of your main site.

HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • The thing is that a broken backend is hard to distinguish from a broken Apache or broken load-balancer. +1 for the workaround. It's a good idea, but we are using SSL terminated in Apache, without SNI extensions so virtual hosts will not work. – ixe013 Jul 17 '15 at 11:49