We are developing a WebDAV server in Java that we would like to serve a Windows' File Explorer client. I can run the following curl
command that gives a good response:
>curl -i -X OPTIONS http://localhost:8080/storage-explorer/rest/dav -u joe:JoeSchmo1!
If I try to "Map Network Drive" using the File Explorer while specifying the same user and password as in the curl
command, I get an "unauthorized" response.
We are developing a WebDAV server in Java that we would like to serve a Windows' File Explorer client. I can run the following curl command that gives a good response:
curl -i -X OPTIONS http://localhost:8080/storage-explorer/rest/dav -u joe:JoeSchmo1!If I try to "Map Network Drive" using the File Explorer while specifying the same user and password as in the curl command, I get an "unauthorized" response.
I examined the requests and responses using WireShark. For curl
, I see:
OPTIONS /storage-explorer/rest/dav HTTP/1.1Host: localhost:8080Authorization: Basic am9lOkpvZVNjaG1vMSE=User-Agent: curl/8.4.0Accept: */*HTTP/1.1 200 OKExpires: 0Cache-Control: no-cache, no-store, must-revalidateServer: milton.io-3.0.0.1Pragma: no-cacheDAV: 1, 2Accept-Ranges: bytesDate: Wed, 27 Mar 2024 17:46:05 GMTAllow: HEAD, PROPFIND, REPORT, OPTIONS, HEAD, PROPPATCHConnection: keep-aliveContent-Length: 0MS-Author-Via: DAV
For File Explorer, I see:
OPTIONS /storage-explorer/rest/dav HTTP/1.1Connection: Keep-AliveUser-Agent: Microsoft-WebDAV-MiniRedir/10.0.19045translate: fHost: localhost:8080HTTP/1.1 401 UnauthorizedExpires: 0Connection: keep-aliveWWW-Authenticate: Basic realm="ApplicationRealm"Cache-Control: no-cache, no-store, must-revalidatePragma: no-cacheContent-Type: text/html;charset=UTF-8Content-Length: 71Date: Wed, 27 Mar 2024 18:06:34 GMT<html><head><title>Error</title></head><body>Unauthorized</body></html>
Another oddity is that I can see activity in our webapp's log for the curl
request, but not for the File Explorer request.
What is the important difference between the two OPTIONS requests that causes the different responses? What can I do from the File Explorer to have it generate an acceptable request, e.g., one equivalent to curl
's?
Based on this article, I used regedit
to modify the HKLM\SYSTEM\CurrentControlSet\Services\WebClient\Parameters\BasicAuthLevel
setting to allow http, but it made no difference.
I'm open to any debugging suggestions.