Can't access Nextcloud webdav directory thru k8s service from different namespace

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 22.2.3-apache
Operating system and version (eg, Ubuntu 20.04): AWS EKS 1.22, AM2 Linux, kernel 5.4.219-126.411.amzn2.x86_64
Apache or nginx version (eg, Apache 2.4.25): Apache bundled with NC 22.2.3 in docker image
PHP version (eg, 7.4): PHP bundled with NC 22.2.3 in docker image
The issue you are facing: Both Nextcloud and Jenkins are working in Kubernetes (in different namespaces). I’m trying to mount webdav directory from different k8s namespace (mount is being done from Jenkins pod) but I’m getting http400 error, that my host (jenkins slave pod) is not listed in allowed hosts configuration.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Mount nextcloud webdav folder from jenkins-slave pod (namespace: cicd) to nextcloud pod(namespace: nextcloud):
    mount -t davfs $WEBDRIVE_URL $DEST -o uid=$OWNER,gid=users,dir_mode=755,file_mode=755
    Mounting failed.
    400 Bad Request
    mount: mounting http://nextcloud.nextcloud.svc.cluster.local:8080/remote.php/dav/files/user/ on /mnt/webdrive failed: No such device
  2. curl nextcloud.nextcloud.svc.cluster.local:8080/remote.php/dav/files/user/ → Access through untrusted domain error
  3. You can normally mount webdav directory using domain name that is tied up thru k8s ingress.

The output of your Nextcloud log in Admin > Logging:


The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

          0 => "localhost",
          1 => "nextcloud.svc.cluster.local",
          2 => "svc.cluster.local",
          3 => "cluster.local",
          4 => "nextcloud",
          5 => "cicd.svc.cluster.local",

The output of your Apache/nginx/system log in /var/log/____: - - [11/Dec/2022:12:37:16 +0000] "OPTIONS /remote.php/dav/files/user/ HTTP/1.1" 400 15073 "-" "davfs2/1.6.1 neon/0.32.2"

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.