N8n caddy ssl

I installed the n8n on the digital ocean (doclker) droplet following the documentation. How do I enable ssl on caddy?

It is automatic - just assign the droplet IP to a domain name and assign that same domain name in the Caddyfile

**your.domainname.com** {
    reverse_proxy n8n:5678 {
      flush_interval -1
    }
}

1 Like

Treyr I did that but it didn’t work just keep accessing http pain

Can you show how your DNS entries look like and then your cadyfile - hard to help otherwise

I have the same issue.

Here’s my docker compose

version: "3.7"

services:
  caddy:
    image: caddy:latest
    container_name: caddy
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ${DATA_FOLDER}/caddy_data:/data
      - ${DATA_FOLDER}/caddy_config:/config
      - ${DATA_FOLDER}/caddy_config/Caddyfile:/etc/caddy/Caddyfile

  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - 5678:5678
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
    volumes:
      - ${DATA_FOLDER}/local_files:/files
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
volumes:
  caddy_data:
    external: true
  caddy_config:

here’s my Caddy file

api.<domain>.<suffix> {
    reverse_proxy n8n:5678 {
      flush_interval -1
    }
}

Here is my DNS config in Digital Ocean.

If I visit https://api.domain.name:5678 I have the error “This site can’t provide a secure connection”.

I am using Digital Ocean NS with the domain. Any idea? I followed the detailed how to in the docs :slight_smile:

You have to go to https://api.domain.name not 5678

Error anyway :confused:

Hey all, I am sorry for the trouble.

Can you check the logs for your caddy container to see if there is any error suggesting what might have gone wrong with provisioning your SSL certificates? I am not sure how caddy’s default docker image handles logs (since I usually run my web servers outside of docker), but I suppose docker logs caddy would be a good entry point.

It might also be worth checking if Digital Ocean applies any additional logic here and puts anything in front of your server that would try to handle SSL termination.

Also - have to state the obvious - after you change the caddy config - hope you retarted caddy.
Caddy gets the SSL certs on startup.
Check yourpath/n8n-digital-ocean/caddy_data/caddy/certificates/acme-v02.api.letsencrypt.org-directory for the ssl certs - if you see a folder with your domain name then at least caddy is getting the certs

1 Like