Nextcloud fails to log in behind Caddy; is disabling caching called for?

Well, I solved the issue, but not in a way that’s particularly satisfying.

I stopped the Caddy container and followed these directions to reset the Nextcloud-AIO instance. Then I set up Nginx Proxy Manager and configured Nextcloud-AIO with that as my reverse proxy instead.

In the process, I also identified that a lot of traffic was coming to my Nextcloud instance because I had previously hosted a different Nextcloud instance at that domain, and my devices were still trying to log in. Three months ago, cloud.xanderwhart.us would have successfully pointed to a Nextcloud server in my home network—just not the one I was currently setting up. So in the process, I also hunted down the rogue devices still trying to log in and disconnected them. There was a brief period in this process where Nextcloud (new) was up, proxied by Nginx Proxy Manager and I could log in, but only briefly; I was frequently ejected and returned to the login screen.

With all that done, Nextcloud is now working properly: I can log in and do everything I’d want, and I am not spontaneously ejected.

I suspect the rogue devices were the primary issue. However, having dealt with them, I’ve also experimented with stopping Nginx Proxy Manager, starting Caddy in its place, and seeing if Caddy does the job. When I did that, I got SSL errors. Maybe Nextcloud-AIO is holding onto the SSL certificate that Nginx generated, and Caddy was using a different one?

I’m not taking a hard stance that Caddy was the issue here, and I hold out hope that one day I might be able to return to a Caddy configuration. But for now, things are working with Nginx Proxy Manager, so I’m hesitant to tinker more.

@TheRettom, thank you for all your help here. Even though I didn’t get it working in Caddy this time, I learned a lot, and really appreciate you taking the time.

For posterity, here are the configuration details for what’s working now, even though it’s for Nginx Proxy Manager and not Caddy:

Make an external network:

docker network create npm-nw

Nginx Proxy Manager Docker Compose file:

# from: https://www.howtoforge.com/how-to-install-and-use-nginx-proxy-manager/
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: npm
    restart: unless-stopped
    ports:
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      # Mysql/Maria connection parameters:
      DB_MYSQL_HOST: <SENSITIVE DATA OMITTED>
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: <SENSITIVE DATA OMITTED>
      DB_MYSQL_PASSWORD: <SENSITIVE DATA OMITTED>
      DB_MYSQL_NAME: <SENSITIVE DATA OMITTED>
      # Uncomment this if IPv6 is not enabled on your host
      DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - /akhet/system/appdata/letsencrypt:/etc/letsencrypt
    networks:
      - npm-nw
      - npm-internal
    depends_on:
      - db
  db:
    image: 'jc21/mariadb-aria:latest'
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: <SENSITIVE DATA OMITTED>
      MYSQL_DATABASE: <SENSITIVE DATA OMITTED>
      MYSQL_USER: <SENSITIVE DATA OMITTED>
      MYSQL_PASSWORD: <SENSITIVE DATA OMITTED>
      MARIADB_AUTO_UPGRADE: '1'
    volumes:
      - /akhet/system/appdata/nginxproxymanager/mysql:/var/lib/mysql
    networks:
      - npm-internal

networks:
  npm-internal:
  npm-nw:
    external: true

Nextcloud-AIO Docker Compose File:

services:
  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:
      - 5050:8080
    environment:
      - APACHE_PORT=11000
      - APACHE_ADDITIONAL_NETWORK=npm-nw
      - NEXTCLOUD_DATADIR=/akhet/system/appdata/nextcloud_data
    networks:
      - npm-nw
      
volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontainer

networks:
  npm-nw:
    external: true

Nginx Proxy Manager Proxy Settings:

  • Details Tab:
    • Domain Names: cloud.xanderwhart.us
    • Scheme: http
    • Forward Hostname/IP: nextcloud-aio-apache
    • Forward Port: 11000
    • Cache Assets: OFF
    • Block Common Exploits: ON
    • Websockets Support: ON
  • SSL Tab:
    • Generate certificate using Let’s Encrypt
    • Force SSL: ON
    • HTTP/2 Support: ON
    • HSTS Enabled: ON
    • HSTS Subdomains: OFF
  • Advanced Tab:
    • Custom Nginx Configuration: (see below)
client_body_buffer_size 512k;
proxy_read_timeout 86400s;
client_max_body_size 0;
proxy_no_cache 1;
proxy_cache_bypass 1;
proxy_cache off;

Again, thanks for all the help.

1 Like