Nextcloud AIO Caddy and Nginx Proxy Manager - 502 Bad Gateway

Oh my god! As I said, a stupid mistake and lack of docker knowledge on my side.
I have read this part of the documentation several times but I did not understand it!
Your hint put me in the right direction.

All the other containers and the Caddy are in the same macvlan network, so it works.
Nextcloud AIO has its own network “nextcloud-aio”. So, connecting the Caddy container to a secondary network “nextcloud-aio” did the trick.

@jtr thank you so much for taking the time and your valuable hint! I have learned a lot!

Now I know how to do it in the future and also for Nginx PM.

My new Caddy compose file:

services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    container_name: caddy

    networks:
      caddy-network:
        ipv4_address: 192.168.178.36    # Change, your caddy ip-address (macvlan)
        mac_address: xx:xx:xx:xx:xx:xx  # fixed mac address for router port forwarding
      nextcloud-aio:

    ports:
      - "80:80"
      - "443:443"
      # - "443:443/udp"

    volumes:
      - ${APPDATA}/caddy/Caddyfile:/etc/caddy/Caddyfile
      # - ./site:/srv
      - ${APPDATA}/caddy/data:/data
      - ${APPDATA}/caddy/config:/config
  
networks:
  caddy-network:
    name: macvlan       # network name of your macvlan network
    external: true
  nextcloud-aio:
    external: true