To whom it may concern: Fixing the 204 error with Webdav on a Nginx/Nextcloud server
Hi everyone,
I had the weirdest bug: Zotero was no longer connecting through Webdav with my self-hosted Nextcloud server, while I could make manual, raw, functioning webdav requests.
Turns out, some tidbit of configuration at the nginx level was the culprit:
location ~ ^/(?:index|public|remote|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
# if ($request_method = 'OPTIONS') {
# return 204;
# }
}
To make it work again, I simply commented out theses three lines, but people more Nginx-savvy could write better configs I guess.
since I think these lines were at some point part of the recommended config for installing Nextcloud on Nginx, I hope that someday, somewhere, this humble post can help someone.
I had the weirdest bug: Zotero was no longer connecting through Webdav with my self-hosted Nextcloud server, while I could make manual, raw, functioning webdav requests.
Turns out, some tidbit of configuration at the nginx level was the culprit:
location ~ ^/(?:index|public|remote|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
# if ($request_method = 'OPTIONS') {
# return 204;
# }
}
To make it work again, I simply commented out theses three lines, but people more Nginx-savvy could write better configs I guess.
since I think these lines were at some point part of the recommended config for installing Nextcloud on Nginx, I hope that someday, somewhere, this humble post can help someone.
if ($request_method = OPTIONS) {
add_header DAV "1, 3" always;
}