[SOLVED] Trying to run Nextcloud-AIO behind a Caddy Reverse Proxy

Hooray, I fixed it!

This is my Caddyfile:

{
  # Email
  email <email>

  # Debug
  # acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
  # debug
}

(cloudflare) {
  tls {
    dns cloudflare <api_token>
  }
}

https://cloud.domain.tld:443 {
  import cloudflare
  reverse_proxy nextcloud-aio-apache:11000
}

docker-compose:

services:
  # Nextcloud
  nextcloud-aio-mastercontainer:
    image: nextcloud/all-in-one:latest
    init: true
    restart: always
    container_name: nextcloud-aio-mastercontainer
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - 8083:8080
    environment:
      - APACHE_PORT=11000
      - APACHE_IP_BINDING=0.0.0.0

  caddy:
    image: caddy-docker-proxy-cloudflare-dns
    restart: always
    container_name: caddy
    environment:
    - CADDY_DOCKER_CADDYFILE_PATH=/etc/caddy/Caddyfile
    ports:
      - 82:80
      - 446:443
    networks:
      - caddy
    volumes:
      - ${APPDATA}/Caddy/Caddyfile:/etc/caddy/Caddyfile
      - /var/run/docker.sock:/var/run/docker.sock

networks:
  caddy:
    external: true

volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontainer
  caddy_data: {}

yes, I did leave the domaincheck on. because if you change the caddyfile line to reverse_proxy nextcloud-aio-domaincheck:11000 before you open nextcloud-aio for the first time, the domaincheck works. Only make sure to change it back to reverse_proxy nextcloud-aio-apache:11000 before you actually install the nextcloud containers.