【问题标题】:/sbin/mount.davfs: mounting failed; the server does not support WebDAV/sbin/mount.davfs:安装失败;服务器不支持 WebDAV
【发布时间】:2022-07-06 16:21:01
【问题描述】:

我正在尝试挂载远程 webdav:

sudo mount -t davfs https://files.isric.org/soilgrids/latest/data/ ~/webdav

但我只收到以下错误:/sbin/mount.davfs: mounting failed; the server does not support WebDAV

此服务器是运行在 kubernetes 集群中的 wsgidav

与 nautilus 相同的问题,使用gvfsd-dav 来调试问题,如here 所示。我有来自服务器的以下 HTTP 请求/响应:

/usr/libexec/gvfsd-dav ssl=true user=anonymous host=files.isric.org  prefix=/soilgrids/latest/data/
dav: setting 'ssl' to 'true'
dav: setting 'user' to 'anonymous'
dav: setting 'host' to 'files.isric.org'
dav: setting 'prefix' to '/soilgrids/latest/data/'
dav: Added new job source 0x556590e0c1a0 (GVfsBackendDav)
dav: Queued new job 0x556590e0a380 (GVfsJobMount)
dav: + mount
> OPTIONS /soilgrids/latest/data HTTP/1.1
> Soup-Debug-Timestamp: 1657091152
> Soup-Debug: SoupSession 1 (0x556590e0c100), SoupMessage 1 (0x7fa1b40060e0), SoupSocket 1 (0x7fa1b43440e0)
> Host: files.isric.org
> Accept-Encoding: gzip, deflate
> User-Agent: gvfs/1.48.2
> Accept-Language: en-us, en;q=0.9
> Connection: Keep-Alive
  
< HTTP/1.1 204 No Content
< Soup-Debug-Timestamp: 1657091152
< Soup-Debug: SoupMessage 1 (0x7fa1b40060e0)
< Date: Wed, 06 Jul 2022 07:05:52 GMT
< Connection: keep-alive
< Strict-Transport-Security: max-age=15724800; includeSubDomains
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Methods: GET, OPTIONS, HEAD
< Access-Control-Allow-Headers: Content-Type, Accept-Ranges, Content-Range, Range, Content-Encoding, Content-Length, Access-Control-Allow-Origin
< Access-Control-Max-Age: 1728000
< Content-Length: 0
< 
  
dav: send_reply(0x556590e0a380), failed=1 (Not a WebDAV enabled share)
dav: Mount failed: Not a WebDAV enabled share

服务器HTTP响应为HTTP/1.1 204 No Content

【问题讨论】:

    标签: kubernetes kubernetes-ingress webdav wsgidav


    【解决方案1】:

    问题在于 k8s 入口有:

    apiVersion: networking.k8s.io/v1 
    kind: Ingress
    metadata:
      annotations:
        nginx.ingress.kubernetes.io/enable-cors: "true"
        nginx.ingress.kubernetes.io/cors-allow-methods: "GET, OPTIONS, HEAD"
        nginx.ingress.kubernetes.io/cors-allow-headers: "Content-Type, Accept-Ranges, Content-Range, Range, Content-Encoding, Content-Length, Access-Control-Allow-Origin"
    

    HTTP/1.1 204 No Content 响应是正确的pre-flight CORS 响应由入口提供,这不是预期的 WebDAV 响应,第一个请求不是甚至到达运行 wsgidav 的 pod。

    解决方案:在入口处禁用 CORS 支持。然后一切正常:

    /usr/libexec/gvfsd-dav ssl=true user=anonymous host=files.isric.org  prefix=/soilgrids/latest/data/
    > OPTIONS /soilgrids/latest/data HTTP/1.1
    > Soup-Debug-Timestamp: 1657095042
    > Soup-Debug: SoupSession 1 (0x55758f924100), SoupMessage 1 (0x7f01180060d0), SoupSocket 1 (0x7f0118342110)
    > Host: dev-files.isric.org
    > Accept-Encoding: gzip, deflate
    > User-Agent: gvfs/1.48.2
    > Accept-Language: en-us, en;q=0.9
    > Connection: Keep-Alive
      
    < HTTP/1.1 200 OK
    < Soup-Debug-Timestamp: 1657095042
    < Soup-Debug: SoupMessage 1 (0x7f01180060d0)
    < Date: Wed, 06 Jul 2022 08:10:42 GMT
    < Content-Type: text/html
    < Content-Length: 0
    < Connection: keep-alive
    < DAV: 1
    < Allow: OPTIONS, HEAD, GET, PROPFIND
    < MS-Author-Via: DAV
    < Strict-Transport-Security: max-age=15724800; includeSubDomains
    < 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-08
      • 2017-09-11
      • 2023-03-31
      相关资源
      最近更新 更多