Create an reverse proxy with Traefik from a certain endpoint onto a local network port

759 views Asked by At

I'm trying to do a reverse proxy with Traefik, like Nginx. To resume, I would like a proxies requests from a certain endpoint onto a local network port, that happens to be a SSH tunnel with Traefik.

Actually it works with Nginx but Would like to stop using Nginx instead of Traefik.

I already test some configs but the Home Assistant Add-on (Autossh) doesn't connect to it. (It works like a charm with Nginx in the same server).

Here, my Traefik configuration :

docker-compose.yml

version: '3.7'

services:
  reverse-proxy:
    restart: always
    image: traefik:chevrotin
    ports:
    - "443:443"
    - "80:80"
    volumes:
    - /srv/traefik.toml:/etc/traefik/traefik.toml
    - /srv/services.toml:/etc/traefik/services.toml
    - /var/run/docker.sock:/var/run/docker.sock
    - /srv/acme.json:/acme.json
    labels:
    - "traefik.http.routers.api.rule=Host(`dashboard.domain.com`)"
    - "traefik.http.routers.api.service=api@internal"
    - "traefik.http.routers.api.entrypoints=http"

    - traefik.http.routers.nas.entrypoints=https
    - traefik.http.routers.nas.rule=Host(`home-assistant.domain.com`)
    - traefik.http.routers.nas.service=nas@file
    - traefik.http.routers.nas.tls=true
    - traefik.http.routers.nas.tls.certresolver=letsencrypt

traefik.toml

[entryPoints]
  [entryPoints.http]
  address = ":80"
  [entryPoints.https]
  address = ":443"

[api]

[providers.docker]
  endpoint = "unix:///var/run/docker.sock"

[providers.file]
  filename = "/etc/traefik/services.toml"

[certificatesResolvers.letsencrypt.acme]
  email = "[email protected]"
  storage = "acme.json"
  [certificatesResolvers.letsencrypt.acme.httpChallenge]
    entryPoint = "http"

services.toml

[http]
  [http.services]
    [http.services.nas]
      [http.services.nas.loadBalancer]
        [[http.services.nas.loadBalancer.servers]]
          url = "http://localhost:44400"
0

There are 0 answers