Skip to content

Instantly share code, notes, and snippets.

@paulsheldrake
Last active December 27, 2015 18:29
Show Gist options
  • Save paulsheldrake/7370210 to your computer and use it in GitHub Desktop.
Save paulsheldrake/7370210 to your computer and use it in GitHub Desktop.
EVO-1176 When the monitoring agents from Zeus or OpenNMS ping the server to see if it is still up it causes a full Drupal bootstrap. This checks the user agent and returns a 200 without starting up Drupal.
diff --git a/.htaccess b/.htaccess
index 8eac0e4..5c5b7fc 100644
--- a/.htaccess
+++ b/.htaccess
@@ -105,6 +105,12 @@ DirectoryIndex index.php index.html index.htm
# uncomment the following line:
# RewriteBase /
+ # EVO-1176 - Redirect monitoring requests to status.php
+ # Status.php is added as part of the deployment process
+ RewriteCond %{HTTP_USER_AGENT} ^HTTP-Monitor.* [OR]
+ RewriteCond %{HTTP_USER_AGENT} ^OpenNMS\ HttpMonitor.*
+ RewriteRule ^ status.php [L]
+
# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment