HTTP works fine, but HTTPS not

Hey there.
I'm quite new to traefik and routing, but I just can't get it to work.

My setup: I am using docker (with docker-compose), a php-container and traefik.

The problem is: If I try to reach my site via HTTP (http://www.example.com) everything works fine, but on https (https://www.example.com) I always get a bad gateway error.

services:
  traefik:
    image: traefik:latest
    container_name: traefik
    ports:
      - 80:80
      - 443:443
#     - 8080:8080 //Webinterface
    command:
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--providers.docker.network=web"
      - "--entryPoints.web.address=:80"
      - "--entryPoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.tlschallenge=true"
      - "--certificatesresolvers.myresolver.acme.email=foo@example.com"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"

    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./certificates/traefik:/letsencrypt"
    networks:
      - web

The labels of my php-container:

      - traefik.enable=true
      - traefik.docker.network=web
      - traefik.http.routers.homepagehttp.service=homepagehttp
      - traefik.http.routers.homepagehttp.entrypoints=web
      - traefik.http.routers.homepagehttp.rule=Host(`example.com`)
      - traefik.http.services.homepagehttp.loadbalancer.server.port=80

      - traefik.http.routers.homepagehttps.service=homepagehttps
      - traefik.http.routers.homepagehttps.entrypoints=websecure
      - traefik.http.routers.homepagehttps.rule=Host(`example.com`)
      - traefik.http.routers.homepagehttps.tls=true
      - traefik.http.routers.homepagehttps.tls.certresolver=myresolver
      - traefik.http.services.homepagehttps.loadbalancer.server.port=443

I am honestly sorry if I am just being stupid and blind here :slight_smile:

Thank you in advance!

Hello,

does your app in your container use ports 443 and 80?

I think that your application only use the port 80.

      - traefik.enable=true
      - traefik.docker.network=web

      - traefik.http.routers.homepagehttp.entrypoints=web
      - traefik.http.routers.homepagehttp.rule=Host(`example.com`)

      - traefik.http.routers.homepagehttps.entrypoints=websecure
      - traefik.http.routers.homepagehttps.rule=Host(`example.com`)
      - traefik.http.routers.homepagehttps.tls=true
      - traefik.http.routers.homepagehttps.tls.certresolver=myresolver


      - traefik.http.services.homepagehttp.loadbalancer.server.port=80

Hi,
thank you for your reply.

The app is a modified Apache-Webserver, which should use 443 also.

EDIT: Nevertheless it works now, thank you!!