How configure apache httpd to answer HTTP 200 with empty body on specific URL?

Solution 1:

The obvious solution would be to create an alias in your configuration and place your empty status page outside of your documentroot so it won't conflict with the URL's your CMS or webmaster might create.

 # Unlikely URL used by loadbalancer for polling
 Alias /sdfjkleruiwbns/dfasdfhasdfjkggfhjfgasqeuryuwerpvbbv/ /var/www/loadbalancer/

With regards to polling by loadbalancers:

The loadbalancers will regularly poll the back-end servers. The results of the poll wil determine if back-end server is healthy and the load-balancer will send requests to a given server or not.

The most basic monitoring supported is a simple TCP-connect check to determine if a service is listening for connections. Normally that test isn’t 100% reliable as it is not uncommon for a listener to still be active when the actual application is unresponsive.

A much better check for a web service would be to retrieve an actual URL, i.e. http://server.local/some/path/page.htm when that URL can be retrieved the loadbalancer considers the node active.

Instead of a static HTML a dynamic health page is even better, but that might be more customisation then required/supported. If everything is OK fi a green light and HTTP status 200 is returned, otherwise an HTTP status of 503 is sent with an orange or red light. A health page would then typically check if all the required conditions for running the application are met, e.g. it can write in the temp space, connect to a back-end database, the license is valid, the maximum queue length hasn’t been reached yet etc. etc. As long as polling that health page won’t result in an effective denial of service of course…

Solution 2:

mod_alias can return a 204 which is an empty page.

RedirectMatch 204 /heart_beat.html