nextcloud / nextcloud/server

[Bug]: Public WebDAV share returns 401 to unauthenticated OPTIONS without WWW-Authenticate

Open
#59,391 0 comments 2 reactions 1 assignee View on GitHub

@ernolf is already working on this.

Since Aug 19, 2026.

0. Needs triage 33-feedback bug feature: authentication feature: dav
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Password-protected public WebDAV shares return 401 Unauthorized to an unauthenticated OPTIONS request, but without a WWW-Authenticate header.

This breaks challenge-based WebDAV clients such as davfs2, even though the same endpoint works correctly when Authorization is sent explicitly.

Actual behavior
  • unauthenticated OPTIONS -> 401 Unauthorized
  • no WWW-Authenticate header in the response
  • authenticated OPTIONS -> 200 OK
  • authenticated PROPFIND -> 207 Multi-Status
Steps to reproduce
  1. Create a password-protected public folder share.

  2. Use its public WebDAV endpoint:

    https://<host>/public.php/dav/files/<token>/

  3. Run:

Unauthenticated OPTIONS:

curl --http1.1 -v -i -X OPTIONS \
'https://<host>/public.php/dav/files/<token>/'
  • unauthenticated OPTIONS -> 401 Unauthorized
  • no WWW-Authenticate header in the response

Authenticated OPTIONS:

curl --http1.1 -v -i \
-H 'Authorization: Basic <base64(anonymous:share_password)>' \
-X OPTIONS \
'https://<host>/public.php/dav/files/<token>/'
  • authenticated OPTIONS -> 200 OK

Authenticated PROPFIND:

curl --http1.1 -v -i \
-u 'anonymous:<share_password>' \
-X PROPFIND -H 'Depth: 0' \
'https://<host>/public.php/dav/files/<token>/'
  • authenticated PROPFIND -> 207 Multi-Status
Expected behavior

Unauthenticated access to a protected public WebDAV share should return:

  • 401 Unauthorized with WWW-Authenticate

so that clients using the standard HTTP auth challenge flow can continue with authentication.

Nextcloud Server version

33

Operating system

Other

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report

List of activated Apps

Nextcloud Signing status

Nextcloud Logs

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.