[GH-ISSUE #99] CORS needs 'Access-Control-Allow-Methods' header #43

Closed
opened 2026-04-08 16:50:01 +03:00 by zhus · 1 comment
Owner

Originally created by @XSnelliusX on GitHub (Jul 8, 2022).
Original GitHub issue: https://github.com/sigoden/dufs/issues/99

Problem
Im trying to upload files to a Dufs server from an other server over http.
For this I run the Dufs server with this command, to anable CORS: dufs -A --enable-cors
But the PUT Request I send to the Server is blocked with the following error message:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at xxx. (Reason: Did not find method in CORS header ‘Access-Control-Allow-Methods’).

After looking in to the server.rs I found that in the add_cors function only the AccessControlAllowOrigin, AccessControlAllowCredentials and AccessControlAllowHeaders headers are set. However WebDav needs the PUT method and therefor the AccessControlAllowMethods header is needed.

Environment:

  • Dufs version: 0.25.0
  • Browser/Webdav Info: Firefox Version 102.0.1
  • OS Info: Windows 11
Originally created by @XSnelliusX on GitHub (Jul 8, 2022). Original GitHub issue: https://github.com/sigoden/dufs/issues/99 **Problem** Im trying to upload files to a Dufs server from an other server over http. For this I run the Dufs server with this command, to anable CORS: `dufs -A --enable-cors` But the PUT Request I send to the Server is blocked with the following error message: > Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at _xxx_. (Reason: Did not find method in CORS header ‘Access-Control-Allow-Methods’). After looking in to the server.rs I found that in the [add_cors](https://github.com/sigoden/dufs/blob/cb1f3cddeaf0f4306430189a2ecd2a04151fae06/src/server.rs#L1006-L1017) function only the `AccessControlAllowOrigin`, `AccessControlAllowCredentials` and `AccessControlAllowHeaders` headers are set. However WebDav needs the PUT method and therefor the `AccessControlAllowMethods` header is needed. **Environment:** - Dufs version: 0.25.0 - Browser/Webdav Info: Firefox Version 102.0.1 - OS Info: Windows 11
zhus closed this issue 2026-04-08 16:50:01 +03:00
Author
Owner

@jens1o commented on GitHub (Jul 8, 2022):

Thank you very much for confirming and implementing the fix, @sigoden ! :) It is stunning that you are reacting this fast to newly made issues! :)

<!-- gh-comment-id:1178703218 --> @jens1o commented on GitHub (Jul 8, 2022): Thank you very much for confirming and implementing the fix, @sigoden ! :) It is stunning that you are reacting this fast to newly made issues! :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sigoden/dufs#43