Sunday, March 06, 2005

Fun with Windows XP and WebDAV

I have an apache server in my basement, and I host sites for a number of people, including this blog. I've tried to give WebDAV access to my clients, but have had all sorts of headaches with accessing Apache2 WebDAV from Windows XP. Windows XP is supposed to support WebDAV pretty nicely (they call it Web Folders), but it's broken in a number of places.

I think I've figured out how to fix that.

The symptom is that a user tries to add a Web Folder from the Windows XP "My Network Places" window, using a URL of the form http://my.site.com/mydirectory.

For discussion's sake, say that their name is 'user', and their password is passwd.

They get a WebDAV authentication window, and they enter their name and password. The authentication window will say "Connecting to my.site.com" in both the titlebar and the message above the username and password fields. The authentication window comes right back, with a username of the form my.site.com\user prefilled in. They enter their password again, and the authentication window comes right back. They can't get into the site. Even if you've got entries for both "user" and "my.site.com\user" in your apache passwd file, it's no good.

You'll see this sort of stuff in the apache access log:

10.0.0.3 - - [06/Mar/2005:15:28:54 -0600] "PROPFIND /mydirectory HTTP/1.1" 401 529 "-" "Microsoft-WebDAV-MiniRedir/5.1.2600"
10.0.0.3 - - [06/Mar/2005:15:28:54 -0600] "PROPFIND /mydirectory HTTP/1.1" 401 529 "-" "Microsoft-WebDAV-MiniRedir/5.1.2600"
10.0.0.3 - - [06/Mar/2005:15:28:54 -0600] "OPTIONS / HTTP/1.1" 200 - "-" "Microsoft-WebDAV-MiniRedir/5.1.2600"
10.0.0.3 - - [06/Mar/2005:15:28:54 -0600] "PROPFIND /mydirectory HTTP/1.1" 401 529 "-" "Microsoft-WebDAV-MiniRedir/5.1.2600"

And interestingly, you'll see nothing at all in the error log.

The secret is to add a port number to the URL - for instance, use:
http://my.site.com:80/mydirectory
rather than
http://my.site.com/mydirectory.

When you do this, you'll get the AuthName from your httpd.conf file in the authentication window above the username and password fields, and the username and password should work, without having to have my.site.com\ prepended to the username.

The theory is that Windows is trying mount this as a CIFS share rather than using WebDAV, and the port number in the URL forces it to be WebDAV, but your guess is as good as mine.

20 Comments:

At 3:18 PM, Anonymous Anonymous said...

I have the same problem, How can I fix it? Thanks

 
At 9:47 AM, Anonymous Anonymous said...

I tried this and for some reason everything is recursively listed in the folder. I can create a new empty folder but when I enter it I see the same new folder. Try connecting like this "http://server/dav/#" I don't know why you need the /# but it works.

 
At 12:48 AM, Anonymous Anonymous said...

Looks like sending the Header
"MS-Author-Via" with a value of DAV helps windows notice that it's talking to dav. I did this with mod_headers in apache2

 
At 3:02 PM, Anonymous Anonymous said...

Thanks for the info about the number sign "#"! Helped a lot.

After some days of trying to get this to work I wrote a summary about the problem at http://ulihansen.kicks-ass.net/aero/webdav.
Listed six possible solutions on the client and the server-side. Additional ideas are welcome!

Ulrich Hansen (just another webadmin)

 
At 3:24 PM, Anonymous Anonymous said...

I had the same issues with apache 2.2.0, AuthType Digest, and Windows XP. After reading about many other people's woes, the simplest workaround was to create user accounts with '@' in the name, formatted like an e-mail address.

Create 'user@domain' or 'user@domain.tld' rather than just 'user'

This tricks XP into not sending 'hostname\username' during authentication. More info available at:

http://www.debian-administration.org/articles/279#comment_10

 
At 4:01 PM, Anonymous Anonymous said...

www.hss.caltech.edu/help/unix/admin/web/apache-webdav-xp

 
At 4:02 PM, Anonymous Anonymous said...

The fix is posted at the URL above, but the URL got truncated. It should be
..../admin/web/apache-webdav-xp

 
At 2:52 PM, Anonymous Anonymous said...

THANK YOU! Man, Windows XP is such a steaming pile. Thanks for the tip!

 
At 1:07 PM, Anonymous Anonymous said...

Beautiful: adding the :80 worked great for me. Merci Beaucoup!!

 
At 2:49 PM, Anonymous Anonymous said...

thank you thank you thank you!

-j

 
At 8:57 AM, Anonymous Anonymous said...

THANK YOUUU! After three days when I was fixing my app to pass the Litmus tests and passing the standard tests didn't solve the MSWin authentication... searching MSN didn't help... YOU HELPED ME!

Elixon

 
At 8:36 AM, Anonymous Anonymous said...

Life saver!

Can't believe how long I searched for this workaround. Well done!

 
At 8:37 AM, Anonymous Dries said...

Life saver!

Can't believe how long I searched for this workaround. Well done!

 
At 10:44 AM, Anonymous Anonymous said...

I had the same problem. For me, it turned out that I was trying to use DAV on a directory that was also a regular url.

Ex: I had /var/www/data available as a regularly accessible url. In httpd.conf I had aliased data to /var/www/data and turned dav on. Since /var/www was the doc root, /var/www/data could be served via regular http or DAV and this made XP confused. The solution ended up being to creat an alias for /var/www/data, say davdata and then turn dav on for the < Location /davdata >. This allows the webserver to then be clear about when to do DAV and when to do regular http (I think). Try it and see.

 
At 12:20 PM, Anonymous Anonymous said...

user@domain is really nice solution, ty

 
At 3:40 PM, Anonymous Matt said...

:80 worked for me!
fantastic.. thanks a lot, I'd be searching for ages for a solution. Stupid MS!

 
At 5:53 PM, Anonymous bill the geek said...

Thanks from JPL. I hate microsoft

 
At 5:12 AM, Anonymous Anonymous said...

Long time... Thank you very much! This worked for me

 
At 8:23 PM, Anonymous Windows XP said...

Thank you very much for the tip, it helped me resolve this issue on my computer and it has helped me rank well at my Job by being the only one knowing how to fix this! Thank you very much!

Best regards,
Gregory.

 
At 2:09 PM, Blogger jolly_rancher said...

I am having a different problem. Apache is 2.2 and the access is by Windows XP Sp2 using SSL. The usersnames and passwords are in Mysql so I am using the libapache-auth-mod-mysql package. I can access the dav site but I have to authenticate three times before opening any folder. If I create a new folder, I have to authenticate three times. Thus, I see four entries in the log: user username not founf. On the fourth time, I am allowed into the folder.

 

Post a Comment

Links to this post:

Create a Link

<< Home