Can't write new file to WebDAV storage

Nextcloud version (eg, 12.0.2): 15
Running nextcloud:latest from Docker Hub

The issue you are facing: I can’t create a new file on external WebDAV storage. Using the same credentials, I have no problem doing it through Windows Explorer or Finder on Mac. The error I see is:

Could not create file "New text file.txt"

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

Steps to replicate it:

  1. Enable support for external storages
  2. Configure a WebDAV storage location (‘Enable encryption’ checked, ‘Enable previews’ checked, all other options in that popup unchecked)
  3. Create a new file on the WebDAV share through Nextcloud’s interface

Relevant logging:

[webdav] Fatal: Sabre\DAV\Exception: Client error: `PUT https://[my account].stackstorage.com/remote.php/webdav//New%20text%20file.txt.ocTransferId764661861.part` resulted in a `404 Not Found` response:
Not Found
 at <<closure>>

 0. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 209
    convertToSabreException(GuzzleHttp\Exception\ClientException {})
 1. /var/www/html/apps/dav/lib/Connector/Sabre/Directory.php line 156
    put(null)
 2. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
    createFile("New text file.txt", null)
 3. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
    createFile("files/testing/WebDAV/New text file.txt", null, null)
 4. <<closure>>
    httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 5. /var/www/html/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
 6. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    emit("method:PUT", [Sabre\HTTP\Requ ... }])
 7. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 8. /var/www/html/apps/dav/lib/Server.php line 301
    exec()
 9. /var/www/html/apps/dav/appinfo/v2/remote.php line 35
    exec()
10. /var/www/html/remote.php line 163
    require_once("/var/www/html/a ... p")

PUT /remote.php/dav/files/testing/WebDAV/New%20text%20file.txt
from 172.17.0.1 by testing at 2019-02-23T13:55:06+00:00

[no app in context] Error: GuzzleHttp\Exception\ClientException: Client error: `PUT https://[my account].stackstorage.com/remote.php/webdav//New%20text%20file.txt.ocTransferId764661861.part` resulted in a `404 Not Found` response:
Not Found
 at <<closure>>

 0. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 66
    create(GuzzleHttp\Psr7\Request {}, "*** sensitive parameter replaced ***")
 1. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 203
    GuzzleHttp\{closure}("*** sensitive parameters replaced ***")
 2. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 156
    callHandler(1, "*** sensitive parameter replaced ***", [GuzzleHttp\Prom ... l])
 3. /var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php line 47
    GuzzleHttp\Promise\{closure}("*** sensitive parameters replaced ***")
 4. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 246
    run(true)
 5. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 223
    invokeWaitFn()
 6. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 267
    waitIfPending()
 7. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 225
    invokeWaitList()
 8. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 62
    waitIfPending()
 9. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php line 131
    wait()
10. /var/www/html/lib/private/Http/Client/Client.php line 266
    request("put", "https://pdedeck ... t", {verify: "/tmp/o ... e})
11. /var/www/html/lib/private/Files/Storage/DAV.php line 504
    put("https://pdedeck ... t", {body: null,auth ... ]})
12. /var/www/html/lib/private/Files/Storage/DAV.php line 411
    uploadFile("/tmp/oc_tmp_Xkqy4z-.part", "New text file.t ... t")
13. /var/www/html/lib/private/Files/Storage/DAV.php line 402
    writeBack("/tmp/oc_tmp_Xkqy4z-.part", "New text file.t ... t")
14. <<closure>>
    OC\Files\Storage\{closure}("*** sensitive parameters replaced ***")
15. /var/www/html/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php line 109
    call_user_func(Closure {})
16. <<closure>>
    stream_close()
17. /var/www/html/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php line 132
    fclose(null)
18. /var/www/html/lib/private/Files/Stream/Encryption.php line 421
    stream_close()
19. <<closure>>
    stream_close()
20. /var/www/html/lib/private/Files/Storage/Wrapper/Encryption.php line 1036
    fclose(null)
21. /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php line 630
    writeStream("New text file.t ... t", null, null)
22. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 169
    writeStream("New text file.t ... t", null)
23. /var/www/html/apps/dav/lib/Connector/Sabre/Directory.php line 156
    put(null)
24. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
    createFile("New text file.txt", null)
25. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
    createFile("files/testing/WebDAV/New text file.txt", null, null)
26. <<closure>>
    httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
27. /var/www/html/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
28. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    emit("method:PUT", [Sabre\HTTP\Requ ... }])
29. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
30. /var/www/html/apps/dav/lib/Server.php line 301
    exec()
31. /var/www/html/apps/dav/appinfo/v2/remote.php line 35
    exec()
32. /var/www/html/remote.php line 163
    require_once("/var/www/html/a ... p")

PUT /remote.php/dav/files/testing/WebDAV/New%20text%20file.txt
from 172.17.0.1 by testing at 2019-02-23T13:55:06+00:00

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

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'ocjz91qbwpnc',
  'passwordsalt' => '[censored]',
  'secret' => '[censored]',
  'trusted_domains' =>
  array (
    0 => 'localhost:32768',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'sqlite3',
  'version' => '15.0.4.0',
  'overwrite.cli.url' => 'http://localhost:32768',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:
didn’t seem relevant here, and didn’t immediately find the relevant logs