Getting Caddy to respond to HTTPS requests

Hi, I have Cabot using Caddy successfully running in plain HTTP on :80 and am trying to run it as HTTPS on :443.

I am using docker-compose -f docker-compose.yml -f docker-compose-caddy.yml up -d to bring up caddy and docker-compose down to take it down.
Visiting https://domain instantly failed and I could see with lsof -i:443 that nothing was listening (lsof -i:80 showed Caddy was listening.)
I changed docker-compose.yml from:

    ports:
      - '80:5000'

to

    ports:
      - '80:5000'
      - '443:5000'

and now I see that something is listening on :443, but I get the same failure to connect when visiting HTTPS after a long timeout.

I think I must be missing something simple. What should I try to do to get Cabot to respond to an HTTPS request? Here are my yml files, and let me know what else I should include.

docker-compose-caddy.yml:

version: "2"

services:
  caddy:
    image: abiosoft/caddy
    ports:
      - '80:80'
      - '443:443'
    depends_on:
      - web
    volumes:
      - ./.caddy:/root/.caddy
      - ./conf/Caddyfile:/etc/Caddyfile

docker-compose.yml:

version: "2"

services:
  web:
    extends:
      file: docker-compose-base.yml
      service: base
    command: sh -c "cabot migrate && gunicorn cabot.wsgi:application -b 0.0.0.0:5000 --workers=5"
    ports:
      - '80:5000'
      - '443:5000'
    depends_on:
      - postgres
      - rabbitmq
    restart: always

  worker:
    extends:
      file: docker-compose-base.yml
      service: base
    command: celery worker -A cabot
    depends_on:
      - web
      - postgres
      - rabbitmq
    restart: always

  beat:
    extends:
      file: docker-compose-base.yml
      service: base
    command: celery beat -A cabot
    depends_on:
      - web
      - postgres
      - rabbitmq
    restart: always

  postgres:
    image: postgres:9.6-alpine
    volumes:
      - data:/var/lib/postgresql/data
    restart: always

  rabbitmq:
    image: rabbitmq:3.6-alpine
    restart: always

volumes:
  data:

lsof -i:443
docker-pr 16567 root 4u IPv6 62870 0t0 TCP *:https (LISTEN)
lost -i:80
docker-pr 16530 root 4u IPv6 62825 0t0 TCP *:http (LISTEN)

lsb_release -a

Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.4 LTS
Release:	16.04
Codename:	xenial

Whats in your Caddyfile?

At a quick glance at this part in particular, you can’t talk HTTP and HTTPS on the same port; Caddy needs separate ports for each.

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