0

I have found many similar questions online, but I am certainly lost in this topic which is new for me and I hope somebody can guide me through my problem. In my setup, I have a docker container which runs a secure version on port 8443 and a "read-only" version on port 8080. Now I want to use Traefik as a proxy to then reroute all requests to the secure version, ignoring the read-only. While the dashboard indicates routing to the service, I am just receiving an "Unable to connect" when trying to access the webpage.

As a compose file:

version: "3.7"

services:
  traefik:
    image: traefik:2.5
    container_name: traefik
    restart: always
    ports:
      - "80:80"
      - "433:433"
    command: --api.insecure=false --providers.docker
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /home/cloud/traefik.yml:/etc/traefik/traefik.yml
    networks:
      - traefik-network

  my-service:
    image: my-image
    env_file: variables.env
    container_name: my-image
    restart: always
    ports:
      - "8080:8080"
      - "8443:8443"
    networks:
      - traefik-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.my-service.entryPoints=websecure"
      - "traefik.http.routers.my-service.rule=Host(`domain.com`)"
      - "traefik.http.services.my-service.loadbalancer.server.port=8443"

networks:
  traefik-network:
    name: traefik-network

And the traefik.yml:

################################################################
# Provider configuration
################################################################
providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"  # default
    exposedByDefault: true   # default 
    network: traefik-network
################################################################
# Entrypoint
################################################################
entryPoints:
  web:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https
  websecure:
    address: ":443"

Maybe somebody has an idea where I went in the wrong direction.

Best

Leanhope
  • 1
  • 4

0 Answers0