-
Notifications
You must be signed in to change notification settings - Fork 168
nginx config: Fix Windows WebDav client error 0x80070043 #2668
Conversation
Windows native WebDav client sends 'OPTIONS / HTTP/1.1' request even if target address is '/remote.php/webdav/'
@adduxa, thanks for your PR! By analyzing the history of the files in this pull request, we identified @carlaschroder and @RealRancor to be potential reviewers. |
Thanks for your PR. Before some one is asking: I have no idea and i also won't touch any Windows (especially their broken WebDAV client). I also don't know the implications of redirecting all OPTIONS requests on / to remove.php/webdav. IMHO this shouldn't be put into the default config but into somewhere into the wiki. |
@RealRancor, if so, this seems to be the right place to go: |
Some additional information for future investigationsIn fact, real behavior is more complicated: it seems like Windows has two different WebDav clients (at least Windows 10) with UserAgents
The problem is Windows first trying to connect with So there is another workaround: first connect some other WebDav cloud which works at root directory ( |
@adduxa There is a recent report about the same issues on oC 9.1.x together with Apache: The user there is saying that this worked in older oC versions so it might be possible that this is a bug in oC itself. |
Forgot to attach more verbose network dump: Before fix:
After fix:
Connect to some WebDav server binded to root
|
Just realize, that WebDav client sends first request to '/', not to '/owncloud/'. Adding 'location = /' section is unacceptably.
@RealRancor @adduxa |
IMHO this is something which should be either put into the documentation wiki or commented out (not enabled by default) in the nginx config. I won't test nor give a |
Valid point, beeing part of the official documentation but commented out is fine and very helpful. |
# Fixes Windows WebDav client error 0x80070043 "The network name cannot be found." | ||
location = / { | ||
if ($request_method = OPTIONS) { | ||
return 301 $scheme://$server_name/remote.php/webdav/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be /remote.php/dav
for oC9+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talking about WebDav - just files access, not calendar, address book and etc. Even official OC desktop client use /remote.php/webdav/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the official endpoint since oC9 (for which you have created the PR here). Sync clients still using remote.php/webdav because they still need to support oC8.2 and below. Once oC8.2 is end-of-life the sync client will switch to remote.php/dav
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, now I saw it. Why, then, in the web-interface link with webdav
in it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are in the mid of changing this for oC9.2: owncloud/core#23904
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, in this situation it does not matter - we just should redirect DavClnt
somwhere, where server returns 401 Unauthorized
code... Hmm.. and what if we will not send 301 Redirect
, but 401 Unauthorized
at once?
I just test it out and it works! Think it is better solution
We just should redirect DavClnt somwhere, where server returns 401 Unauthorized code. So it will work if we return it right here.
Make fix working only for Windows DavClnt client UserAgent. Nginx doesn't allow multiple or nested if statements. So it is little tricky to implement AND-like behavior.
Because I do not like IF statements in nginx very much, only where really needed, another suggestion. Create a file in nginx/conf.d like
Than add the following to your server block
The nice thing here is, that you can add as many map directives as you want and commenting it out is only one line in location and not many. Info: in map, ":" is used just like delimiter, you can use any other symbol not used in checked variables.
|
This is good replacement for that huge IF-AND statement, I'll remember it. But with the requirement to split the config to a several files things becomes even more complicated. |
We can remove `$request_method = OPTIONS` and stay only with `$http_user_agent = DavClnt` condition since DavClnt always send OPTIONS requests, so we don't have to check it.
The solution is found in this comment: owncloud/core#26350 (comment) Fix: Or in cmd (as admin):
|
@adduxa Thanks for the follow-up information. Maybe something to document in https://doc.owncloud.org/server/latest/user_manual/files/access_webdav.html#known-problems |
Windows native client gives error 0x80070043 "The network name cannot be found." when you creating network drive for ownCloud.
After some researches I figured out problem:
WebDav client sends
OPTIONS / HTTP/1.1
request even if target address was/remote.php/webdav/
.So obvious solution is to send 301 redirect to
/remote.php/webdav/
for allOPTIONS
requests to/
.Network dump before fix:
Network dump after fix:
Fix: