0

I have a small lab setup on docker lab server where I have several containers. I wanted to set up a proxy with Traefik, but I stuck on one thing.

Looks like routing works fine but I am having err_connection_refused when I try to access routed services by the browser.

It works fine with the curl command.

Using DNSMasq to manage records - traefik for proxy.

Below docker-compose files for traefik and test container which I am using for testing the proxy.

Heimdall Dashboard:

---
version: "2.1"
services:
  heimdall:
    image: lscr.io/linuxserver/heimdall:latest
    container_name: heimdall
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
    volumes:
      - /path/to/appdata/config:/config
    restart: unless-stopped
    labels:
    - "traefik.http.routers.heimdall-www.rule=Host(`heimdall.lab`)"
    - "traefik.http.services.heimdall-www.loadbalancer.server.port=80"
networks:
  default:
    name: traefik_default

Traefik container:

version: '3'
services:
  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.9
    # Enables the web UI and tells Traefik to listen to Docker
    command: --api.insecure=true --providers.docker
    ports:
      # The HTTP port
      - "80:80"
      # The Web UI (enabled by --api.insecure=true)
      - "8080:8080"
    volumes:
      # So that Traefik can listen to the Docker events
      - /var/run/docker.sock:/var/run/docker.sock
  whoami:
    # A container that exposes an API to show its IP address
    image: traefik/whoami
    labels:
      - "traefik.http.routers.whoami.rule=Host(`whoami.lab`)"
      - "traefik.http.services.whoami.loadbalancer.server.port=80"

DNSmasq entry

address=/.lab/127.0.0.1

I dont understand why curling works fine e.g.:

curl -H Host:whoami.lab http://192.168.0.150
Hostname: 1ad1e42dd818
IP: 127.0.0.1
IP: 172.21.0.4
RemoteAddr: 172.21.0.2:54128
GET / HTTP/1.1
Host: whoami.lab
User-Agent: curl/7.84.0
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 192.168.0.100
X-Forwarded-Host: whoami.lab
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: ca631c80565a
X-Real-Ip: 192.168.0.100
revan
  • 17
  • 3

0 Answers0