I cannot connect n8n to Nextcloude, both deployed in Docker Desktop

Describe the problem/error/question

I am using self-hosted instance if both n8n and Nextcloud installed in Docker Desktop on my Macbook pro.
I am trying to create Nextcloud credentials in n8n to be able to retrieve files, and I cannot get to make it work, I have tried everything:

For the Web DAV URL I have tried both options:

Below is the error I get

What is the error message (if any)?

Couldn’t connect with these settings

Bad request - please check your parameters

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: self hosted 11.6.4
  • Database default: SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via Docker
  • Operating system: macOS

Hey @dejan-dimeski :slight_smile:

this kind of issue is almost always the WebDAV URL format or the type of password being used.

For a self-hosted Nextcloud + n8n running in Docker Desktop on macOS, the WebDAV URL in your n8n credentials should look like this

http://host.docker.internal:8080/remote.php/webdav/

things to double-check:

→ Make sure you’re using /remote.php/webdav/ with the trailing slash

→ Don’t use /remote.php/dav/files — that endpoint won’t work for n8n

→ Use a Nextcloud app password, not your main account password
Nextcloud: Avatar → Personal settings → Security → App passwords


If it still fails, try watching the Nextcloud logs while hitting “Test” in n8n:

docker logs -f nextCloudContainerName
docker logs -f nextCloudContainerName

For me there were only two most common errors which i found, 401→Credential Issues & 400→Url/Path. I recommend reading the official N8N Docs For NextCloud Credentials & Auth, let me know if you still face the same issue

Hi @dejan-dimeski please can you share how you are hosting these services in docker?

  1. Did you manually start them up, or
  2. Did you use a docker compose (recommended) file?

If you used a docker compose file, it is better to reference the service name as the host instead of trying to find the internal ip on docker.

UPDATE: So after going through all possible remedies recommended here and both in n8n and Nextcloude knowledge base, the one that worked was - adding trusted domains for reaching Nextcloud:

# Keep localhost explicitly (if not already)
docker exec -u www-data -it <NEXTCLOUD_CONTAINER> \ php occ config:system:set trusted_domains 0 --value=localhost
# Allow host.docker.internal (used by n8n)
docker exec -u www-data -it <NEXTCLOUD_CONTAINER> \ php occ config:system:set trusted_domains 1 --value=host.docker.internal
# (Optional) Allow the container name itself (if you want to call it as "http://nextcloud")  
docker exec -u www-data -it <NEXTCLOUD_CONTAINER> \  php occ config:system:set trusted_domains 2 --value=nextcloud
1 Like

Glad to hear you got it working
Adding the trusted domains is definitely one of the fixes that solves a lot of WebDAV connection issues. Nice job tracking it down

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.