OpenMediaVault-Plugin-Developers / openmediavault-webdav

webdav plugin for OpenMediaVault
22 stars 6 forks source link

HTTP status code for non-existent paths is 302 instead of 404 #21

Closed xmcp closed 8 months ago

xmcp commented 8 months ago

Currently some clients like Zotero cannot connect to OMV WebDAV, reporting an error Your WebDAV server is claiming that a nonexistent file exists:

image

We can confirm that OMV indeed responds with 302 for an non-existent path in access log:

IP - username [13/Mar/2024:03:22:40 +0800] "GET /webdav/zotero/nonexistent.prop HTTP/1.1" 302 138 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0"
IP - - [13/Mar/2024:03:22:41 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0"

This is because the main site configuration (/etc/nginx/sites-enabled/openmediavault-webgui) redirects all 404 pages to homepage:

error_page 404 = $scheme://$host:$server_port/#/404;

This plugin should override the above error_page directive in the webdav location to avoid this behavior. I will open a PR for this.

ryecoaaron commented 8 months ago

7.0.2 is in the repo now.