Internal Server Error on all routes - are my routers and services configured properly?

Hi, I've finally gotten my config to the point where I'm certain it's close to being correct, but I'm having a few issues, and I suspect that my dynamic config needs some modification.

I have SSL working, but I always get an Internal Server Error when trying to navigate to my domain, regardless of the subdomain. I also get a Moved Permanently response when hitting the http domain address with curl, but since I have https redirection enabled I suspect this is fine.

Here's the basic outline of my dynamic config:

http:

  routers:
    gotify:
      rule: "Host(`gotify.example.com`)"
      service: "gotify"
      tls:
        certResolver: "letsencrypt"
    flame:
      rule: "Host(`example.com`)"  # I want this service to be accessible from my root domain
      service: "flame"
      tls:
        certResolver: "letsencrypt"

  services:
    flame:
      loadBalancer:
        servers:
          - url: "localhost:5005"  # the port the docker service is running on locally
    gotify:
      loadBalancer:
        servers:
          - url: "localhost:8071"

and here's the relevant section of my docker-compose.yaml file:

version: "3.8"
services:

  traefik:
    image: traefik:v2.9
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.traefik-secure.entrypoints=websecure"
      - "traefik.http.routers.traefik-secure.rule=Host(`example.com`)"  # this seems odd since I want the root domain to be a service
      - "traefik.http.routers.traefik-secure.service=api@internal"
    ports:
      - 80:80
      - 443:443
      - 9090:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /etc/traefik/letsencrypt:/letsencrypt/acme
      - /etc/traefik:/etc/traefik/:ro

  flame:
    image: pawelmalak/flame
    container_name: flame
    ports:
    - 5005:5005  # the same port defined in the service of the dynamic config

I'd sure appreciate any and all help.

Use

.loadbalancer.servers.url: http(s)://IP

I don’t think you can use localhost as target, as localhost within a container (by default) is not localhost on the host.

Usually a Docker network is created and Traefik and service are both using it.