Configure Apache to ignore WebDAV requests

Q Our intranet runs on Debian Sarge, with around 1,500 Windows 2000 PCs that can access the web server (we're running Apache 2.0.54). A few of these PCs seem to have a WebDav service running that is trying to connect to the intranet web server, and it's filling up my logs. Is there any easy way of configuring Apache to simply ignore all requests made from this WebDAV service? The browser user agent is 'Microsoft-WebDAV- MiniRedir/5.1.2600'.

A You can block (or allow) requests based on the browser's user agent with a combination of the SetEnvIf and Deny (or Allow) directives. These can be included in a [Directory] section of your httpd.conf or in a .htaccess file. As you want to block all requests for this user agent, I would recommend the [Directory] section corresponding to your document root setting. The directives to use to block this particular user agent are

SetEnvIf User-Agent ^Microsoft-WebDAV-MiniRedir BegoneWebDAV
Order Allow,Deny
Deny from env=BegoneWebDAV

The first line sets the environment variable BegoneWebDAV if the user agent begins with 'Microsoft-WebDAV-MiniRedir', which means it will still work when the version number changes. The next part denies access if this variable is set. The combination of SetEnvIf with Allow and Deny lends a great deal of control over who or what can access any part of your site. For more information, see

httpd.apache.org/docs/2.0/mod/mod_setenvif.html#setenvif
httpd.apache.org/docs/2.0/mod/mod_access.html#deny
httpd.apache.org/docs/2.0/mod/mod_access.html#allow

Back to the list