Jorge Mendes
Jorge Mendes

Reputation: 446

/sbin/mount.davfs: mounting failed; the server does not support WebDAV

I am trying to mount a remote webdav:

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

But I only get the following error: /sbin/mount.davfs: mounting failed; the server does not support WebDAV

This server is a wsgidav running in a kubernetes cluster.

Same problem with nautilus, using gvfsd-dav to debug the problem as indicated here. I've the following HTTP requests/responses from the server:

/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

The server HTTP response is HTTP/1.1 204 No Content

Upvotes: 1

Views: 1400

Answers (1)

Jorge Mendes
Jorge Mendes

Reputation: 446

The problem lies on the k8s ingress that has:

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"

The HTTP/1.1 204 No Content response is the correct pre-flight CORS response that is provided by the ingress, this is not the expected WebDAV reponse, and the first request was not even reaching the pod running wsgidav.

Solution: Disable CORS support on ingress. and then things are OK:

/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
< 

Upvotes: 1

Related Questions