Reverse proxy to remote url

Hi,

I have a main server, exposed to the outside with ports 80 and 443.
I already have a Traefik instance working well with docker.
I now have a RaspberryPi, on my network, that I would like to expose, but through my main reverse-proxy (traefik).

It should look like this.

But I'm not able to generate my backend service.
As if Traefik doesn't care about my configuration.

My docker-compose.yml file:

version: "2"

services:
  traefik:
    image: traefik:latest
    restart: always
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    networks:
      - web
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./acme.json:/acme.json
      - ./traefik.yaml:/traefik.yaml
    container_name: traefik

  whoamii:
    image: containous/whoami
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`leon.xxxxxx.fr`)"
    networks: 
      - web

networks:
  web:
    external: true
  local: 

My traefik.yml :

log: 
  level: DEBUG
api: 
  insecure: true  
entryPoints: 
  web: 
    address: ":80"
  websecure: 
    address: ":443"
providers: 
  docker: 
    exposedByDefault: false
certificatesResolvers:
  letsencrypt:
    acme:
      email: xxxxxxxxx@gmail.com
      storage: /acme.json
      tlschallenge: {}
http: 
  routers: 
    homeass:
      entryPoints: 
        - websecure
      service: homeass
      rule: "Host(`domo.xxxxxx.fr`)"
      tls: {}
  services: 
    homeass:
      loadBalancer:
        servers: 
          - "http://192.168.1.202"

When I access to my dashboard, I have no trace of my service.


Traefik logs :

time="2021-03-27T10:41:55Z" level=info msg="Configuration loaded from file: /traefik.yaml"
time="2021-03-27T10:41:55Z" level=info msg="Traefik version 2.4.8 built on 2021-03-23T15:48:39Z"
time="2021-03-27T10:41:55Z" level=debug msg="Static configuration loaded {\"global\":{\"checkNewVersion\":true},\"serversTransport\":{\"maxIdleConnsPerHost\":200},\"entryPoints\":{\"traefik\":{\"address\":\":8080\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{},\"http\":{}},\"web\":{\"address\":\":80\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{},\"http\":{}},\"websecure\":{\"address\":\":443\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{},\"http\":{}}},\"providers\":{\"providersThrottleDuration\":2000000000,\"docker\":{\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ normalize .Name }}`)\",\"swarmModeRefreshSeconds\":15000000000}},\"api\":{\"insecure\":true,\"dashboard\":true},\"log\":{\"level\":\"DEBUG\",\"format\":\"common\"},\"certificatesResolvers\":{\"letsencrypt\":{\"acme\":{\"email\":\"xxxxxxxxx@gmail.com\",\"caServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"storage\":\"/acme.json\",\"keyType\":\"RSA4096\",\"tlsChallenge\":{}}}},\"pilot\":{\"dashboard\":true}}"
time="2021-03-27T10:41:55Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://doc.traefik.io/traefik/contributing/data-collection/\n"
time="2021-03-27T10:41:56Z" level=info msg="Starting provider aggregator.ProviderAggregator {}"
time="2021-03-27T10:41:56Z" level=debug msg="Start TCP Server" entryPointName=web
time="2021-03-27T10:41:56Z" level=debug msg="Start TCP Server" entryPointName=websecure
time="2021-03-27T10:41:56Z" level=debug msg="Start TCP Server" entryPointName=traefik
time="2021-03-27T10:41:56Z" level=info msg="Starting provider *traefik.Provider {}"
time="2021-03-27T10:41:56Z" level=info msg="Starting provider *acme.Provider {\"email\":\"xxxxxxxxx@gmail.com\",\"caServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"storage\":\"/acme.json\",\"keyType\":\"RSA4096\",\"tlsChallenge\":{},\"ResolverName\":\"letsencrypt\",\"store\":{},\"TLSChallengeProvider\":{\"Timeout\":4000000000},\"HTTPChallengeProvider\":{}}"
time="2021-03-27T10:41:56Z" level=info msg="Testing certificate renew..." providerName=letsencrypt.acme
time="2021-03-27T10:41:56Z" level=info msg="Starting provider *docker.Provider {\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ normalize .Name }}`)\",\"swarmModeRefreshSeconds\":15000000000}"
time="2021-03-27T10:41:56Z" level=info msg="Starting provider *acme.ChallengeTLSALPN {\"Timeout\":4000000000}"
time="2021-03-27T10:41:56Z" level=debug msg="Configuration received from provider internal: {\"http\":{\"routers\":{\"api\":{\"entryPoints\":[\"traefik\"],\"service\":\"api@internal\",\"rule\":\"PathPrefix(`/api`)\",\"priority\":2147483646},\"dashboard\":{\"entryPoints\":[\"traefik\"],\"middlewares\":[\"dashboard_redirect@internal\",\"dashboard_stripprefix@internal\"],\"service\":\"dashboard@internal\",\"rule\":\"PathPrefix(`/`)\",\"priority\":2147483645}},\"services\":{\"api\":{},\"dashboard\":{},\"noop\":{}},\"middlewares\":{\"dashboard_redirect\":{\"redirectRegex\":{\"regex\":\"^(http:\\\\/\\\\/(\\\\[[\\\\w:.]+\\\\]|[\\\\w\\\\._-]+)(:\\\\d+)?)\\\\/$\",\"replacement\":\"${1}/dashboard/\",\"permanent\":true}},\"dashboard_stripprefix\":{\"stripPrefix\":{\"prefixes\":[\"/dashboard/\",\"/dashboard\"]}}},\"serversTransports\":{\"default\":{\"maxIdleConnsPerHost\":200}}},\"tcp\":{},\"tls\":{}}" providerName=internal
time="2021-03-27T10:41:56Z" level=debug msg="Configuration received from provider letsencrypt.acme: {\"http\":{},\"tls\":{}}" providerName=letsencrypt.acme
time="2021-03-27T10:41:56Z" level=debug msg="Added outgoing tracing middleware api@internal" entryPointName=traefik routerName=api@internal middlewareName=tracing middlewareType=TracingForwarder
time="2021-03-27T10:41:56Z" level=debug msg="Added outgoing tracing middleware dashboard@internal" middlewareName=tracing middlewareType=TracingForwarder routerName=dashboard@internal entryPointName=traefik
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" middlewareName=dashboard_stripprefix@internal middlewareType=StripPrefix entryPointName=traefik routerName=dashboard@internal
time="2021-03-27T10:41:56Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik middlewareName=dashboard_stripprefix@internal routerName=dashboard@internal
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" middlewareType=RedirectRegex routerName=dashboard@internal entryPointName=traefik middlewareName=dashboard_redirect@internal
time="2021-03-27T10:41:56Z" level=debug msg="Setting up redirection from ^(http:\\/\\/(\\[[\\w:.]+\\]|[\\w\\._-]+)(:\\d+)?)\\/$ to ${1}/dashboard/" middlewareType=RedirectRegex routerName=dashboard@internal entryPointName=traefik middlewareName=dashboard_redirect@internal
time="2021-03-27T10:41:56Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" entryPointName=traefik middlewareName=traefik-internal-recovery middlewareType=Recovery
time="2021-03-27T10:41:56Z" level=debug msg="No default certificate, generating one"
time="2021-03-27T10:41:56Z" level=debug msg="Provider connection established with docker 20.10.5 (API 1.41)" providerName=docker
time="2021-03-27T10:41:56Z" level=debug msg="Filtering disabled container" providerName=docker container=traefik-traefik-397be1c7726c7769164589ec1eb0ad75442088b451dc2c9dbe9ba37027361539
time="2021-03-27T10:41:56Z" level=debug msg="Filtering disabled container" providerName=docker container=minidlna-minidlna-a0f6950e4c89726cfc8900c45b1ad5515b4a2f177a215a9c4471ff9003c76c74
time="2021-03-27T10:41:56Z" level=debug msg="Configuration received from provider docker: {\"http\":{\"routers\":{\"whoami\":{\"service\":\"whoamii-traefik\",\"rule\":\"Host(`leon.xxxxxxxxx.fr`)\"}},\"services\":{\"whoamii-traefik\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.20.0.2:80\"}],\"passHostHeader\":true}}}},\"tcp\":{},\"udp\":{}}" providerName=docker
time="2021-03-27T10:41:56Z" level=debug msg="No default certificate, generating one"
time="2021-03-27T10:41:56Z" level=debug msg="Added outgoing tracing middleware api@internal" middlewareType=TracingForwarder entryPointName=traefik routerName=api@internal middlewareName=tracing
time="2021-03-27T10:41:56Z" level=debug msg="Added outgoing tracing middleware dashboard@internal" entryPointName=traefik routerName=dashboard@internal middlewareName=tracing middlewareType=TracingForwarder
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" middlewareName=dashboard_stripprefix@internal middlewareType=StripPrefix routerName=dashboard@internal entryPointName=traefik
time="2021-03-27T10:41:56Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex
time="2021-03-27T10:41:56Z" level=debug msg="Setting up redirection from ^(http:\\/\\/(\\[[\\w:.]+\\]|[\\w\\._-]+)(:\\d+)?)\\/$ to ${1}/dashboard/" middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik routerName=dashboard@internal
time="2021-03-27T10:41:56Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" entryPointName=traefik middlewareName=traefik-internal-recovery middlewareType=Recovery
time="2021-03-27T10:41:56Z" level=debug msg="No default certificate, generating one"
time="2021-03-27T10:41:56Z" level=debug msg="No default certificate, generating one"
time="2021-03-27T10:41:56Z" level=debug msg="No entryPoint defined for this router, using the default one(s) instead: [web websecure]" routerName=whoami
time="2021-03-27T10:41:56Z" level=debug msg="Added outgoing tracing middleware api@internal" routerName=api@internal middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik
time="2021-03-27T10:41:56Z" level=debug msg="Added outgoing tracing middleware dashboard@internal" entryPointName=traefik routerName=dashboard@internal middlewareName=tracing middlewareType=TracingForwarder
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal middlewareType=StripPrefix
time="2021-03-27T10:41:56Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex entryPointName=traefik
time="2021-03-27T10:41:56Z" level=debug msg="Setting up redirection from ^(http:\\/\\/(\\[[\\w:.]+\\]|[\\w\\._-]+)(:\\d+)?)\\/$ to ${1}/dashboard/" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex
time="2021-03-27T10:41:56Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=traefik
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" routerName=whoami@docker serviceName=whoamii-traefik middlewareName=pipelining middlewareType=Pipelining entryPointName=web
time="2021-03-27T10:41:56Z" level=debug msg="Creating load-balancer" serviceName=whoamii-traefik entryPointName=web routerName=whoami@docker
time="2021-03-27T10:41:56Z" level=debug msg="Creating server 0 http://172.20.0.2:80" serverName=0 entryPointName=web routerName=whoami@docker serviceName=whoamii-traefik
time="2021-03-27T10:41:56Z" level=debug msg="Added outgoing tracing middleware whoamii-traefik" middlewareName=tracing routerName=whoami@docker entryPointName=web middlewareType=TracingForwarder
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=web
time="2021-03-27T10:41:56Z" level=debug msg="Creating middleware" middlewareType=Recovery entryPointName=websecure middlewareName=traefik-internal-recovery
time="2021-03-27T10:41:56Z" level=debug msg="No default certificate, generating one"
time="2021-03-27T10:41:56Z" level=debug msg="No default certificate, generating one"
time="2021-03-27T10:45:50Z" level=debug msg="Serving default certificate for request: \"\""

What did I miss ?
Why can't I generate my service ?

Thanks for the help,
LeNouveau

Hi @LeNouveau

You are mixing static and dynamic configuration in your traefik.yml
https://doc.traefik.io/traefik/getting-started/configuration-overview/

Split out your dynamic options into another file and add a parameter to load the dynamic configuration.
https://doc.traefik.io/traefik/providers/file/#configuration-examples

1 Like

Hi,

I never realised there are 2 types of files.

## Dynamic configuration

Now, I understand what it means, in the examples. ^^'

Thanks you !