How to reverse proxy WebDAV url using nginx

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): 21.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): nginx 1.18.0
PHP version (eg, 7.4): 8.0

The issue you are facing: Cannot reverse proxy WebDAV url using nginx. I can get the common WebDAV url as, but I want to make it shorter, using subdomains like

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

Steps to replicate it:

  1. Setup NextCloud as normal
  2. In /etc/nginx/conf.d/dav.conf, I wrote as follows:
server {
    listen 443 ssl;

    ssl_certificate /etc/letsencrypt/live/;
    ssl_certificate_key /etc/letsencrypt/live/;

    location / {
        proxy_set_header Host;
  1. Access using normal WebDAV client, and I get following file list:
- Folder 1
- Folder 2
- Folder 3
- webdav
  1. Even if I click any folder, I can’t see any contents of them.

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

$CONFIG = array (
  'passwordsalt' => '****',
  'secret' => '****',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '',
  'datadirectory' => '/usr/share/nginx/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextuser',
  'dbpassword' => '****',
  'installed' => true,
  'instanceid' => '****',
  'skeletondirectory' => '',
  'overwrite.cli.url' => '',

The output of your Apache/nginx/system log in /var/log/____: - - [06/May/2021:18:39:25 +0900] "PROPFIND /remote.php/webdav/Private/ HTTP/2.0" 200 1281 "-" "Transmit/5.7.4" - - [06/May/2021:18:39:25 +0900] "PROPFIND /remote.php/webdavremote.php/webdav/Private/ HTTP/1.0" 200 3306 "-" "Transmit/5.7.4"

From the nginx log, I think this issue is caused by infinite redirect of path, but I don’t know how to resolve it.