Redirect HTTPS to docker-container port 80 with SSL

Hey,

I have a docker container that listens on port 8000.
What I need is an SSL routing to that port.

So: https://container.example.com -> docker-container:8000

This is my docker-compose.yml where traefik is defined:

version: "3.9" 
services:
  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.4
    container_name: traefik
    command: 
      - "--providers.docker"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.httpchallenge=true"
      - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.myresolver.acme.email=mail@example.com"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./letsencrypt:/letsencrypt
    restart: always
    networks:
      vpcbr:
        ipv4_address: 10.5.0.2
    labels:
      - traefik.http.routers.traefik=true
      - traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https
      - traefik.http.routers.traefik.rule=Host(`traefik.example.com`)
      - traefik.http.routers.traefik.tls=true
      - traefik.http.routers.traefik.entrypoints=web

This is the docker-compose.yml with the container:

version: '3'
services:
    web:
        image: jitsi/web:stable-6173
        container_name: jitsi
        restart: always
        ports:
            - '8000:80'
        volumes:
            - ${CONFIG}/web:/config:Z
            - ${CONFIG}/transcripts:/usr/share/jitsi-meet/transcripts:Z
        labels:
            - traefik.http.routers.jitsi.rule=Host(`meet.example.com`)
            - traefik.http.routers.jitsi.tls=true
            - traefik.http.routers.jitsi.entrypoints=websecure
            - traefik.http.routers.jitsi.tls.certresolver=myresolver    
        networks:
            vpcbr:
                ipv4_address: 10.5.0.10
            meet.jitsi:

What I get is:
https://meet.example.com --> "Gateway Timeout"
http://meet.example.com:8000 --> Docker container but without SSL

I fixed it myself by removing the ports of the jitsi container and adding traefik to the meet.jitsi network.

My files now look like this.

Traefik:

version: "3.9" 
services:
  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.4
    container_name: traefik
    command: 
      - "--providers.docker"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.httpchallenge=true"
      - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.myresolver.acme.email=mail@example.com"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./letsencrypt:/letsencrypt
    restart: always
    networks:
      vpcbr:
        ipv4_address: 10.5.0.2
      meet.jitsi:
    labels:
      - traefik.http.routers.traefik=true
      - traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https
      - traefik.http.routers.traefik.rule=Host(`traefik.example.com`)
      - traefik.http.routers.traefik.tls=true
      - traefik.http.routers.traefik.entrypoints=web

Jitsi:

version: '3'
services:
    web:
        image: jitsi/web:stable-6173
        container_name: jitsi
        restart: always
        volumes:
            - ${CONFIG}/web:/config:Z
            - ${CONFIG}/transcripts:/usr/share/jitsi-meet/transcripts:Z
        labels:
            - traefik.http.routers.jitsi.rule=Host(`meet.example.com`)
            - traefik.http.routers.jitsi.tls=true
            - traefik.http.routers.jitsi.entrypoints=websecure
            - traefik.http.routers.jitsi.tls.certresolver=myresolver    
        networks:
            meet.jitsi:

The reason for this:
Traefik was not able to route to Jitsi becaus Traefik was not in the same network as Jitsi.
By adding Traefik to the meet.jitsi network the routing works like it should.

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