Apache 2.4.9 WebDAV DirectoryIndex problem

Written by Matej Drolc

A while ago I upgraded Apache running on my Windows machine from 2.2 to 2.4 (2.4.9 to be exact). I did so by installing the WampServer stack. Some things stopped working and I was able to fix most of them but one. My WebDAV setup stopped working after the migration. Since I rarely use it I let it be but today I decided to dig into it and have found the problem to be a bug in Apache 2.4.x (could be other versions too).

Symptoms

I did some debugging. A basic webdav config with digest auth would look something like this:

Alias /webdav "c:/wamp/www/webdav"
<Location /webdav >        
    Order allow,deny
    Allow from all    
    Dav On

    AuthType Digest
    AuthName DAV-upload
    AuthDigestProvider file
    AuthUserFile "c:/wamp/blahblah.passwd"

    Require valid-user
</Location>

This however stopped working for me with Apache 2.4.9. When trying to map the webdav location to a windows drive I would get an error: “The network path was not found. Error code 0x80070035.”

Alt text

In the background a request like this is sent:

PROPFIND http://example.com/webdav/ HTTP/1.1
User-Agent: Microsoft-WebDAV-MiniRedir/6.3.9600
Depth: 0
translate: f
Connection: Keep-Alive
Content-Length: 0
Host: example.com
Authorization: Digest username="someUser",realm="webdav",nonce="5a2a2178c007e77ba8935157451cf3",uri="/webdav/",cnonce="4091fa2ad1af5481ce26f4a90fb962",nc=00000001,algorithm=MD5,response="507fa5932dd63682cf2c10c6746a6b",qop="auth"

And a response like this is received:

HTTP/1.1 405 Method Not Allowed
Date: Fri, 27 Jun 2014 06:46:57 GMT
Server: Apache
Allow: GET,HEAD,POST,OPTIONS,TRACE
Content-Length: 245
Keep-Alive: timeout=5, max=97
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method PROPFIND is not allowed for the URL /webdav/index.html.</p>
</body></html>

That appended “index.html” made me think, so I tried renaming it. And bingo! WebDAV started working. Armed with this clue I googled some more and finally found a report of a bug in Apache causing such behavior.

Solution

The simplest solution is to apply this workaround to all your WebDAV-enabled locations:

<Limit PROPFIND>
DirectoryIndex never-encounterable-file-name.html
</Limit>

Keywords:

Apache 2.4 wamp webdav directoryindex index.html problem. The network path was not found. Error code 0x80070035. PROPFIND 405 Method Not Allowed. The requested method PROPFIND is not allowed for the URL /index.html.