Search code examples
traefik

Simple Traefik reverse proxy configuration


I'm starting up Traefik version 2.1.4 with the following configuration:

defaultEntryPoints:
  - http

entryPoints:
  hole-1:
    address: ':663'

frontends:
  hole-frontend-1:
    backend: hole-backend-1
    entrypoints:
      - hole-1

backends:
  hole-backend-1:
    servers:
      hole-server-1:
        url: 'http://11.23.24.1:3000'
        weight: 10

When I hit the http://11.23.24.1:663 I'm hit with the Traefik page 404 pages not found. When I go to http://11.23.24.1:3000 in the browser, it works, it displays the page.

I can't seem to figure out how to set up a reverse proxy in Traefik to point http://11.23.24.1:663 to http://11.23.24.1:3000.

I tried this, but I get the error

2020/02/18 11:39:43 command traefik.exe error: no valid configuration found in file: C:\config\traefik.yaml

http:
  routers:
    hole-router-1:
      rule: "Host(`11.23.24.1`) && PathPrefix(`/`)"
      service: hole-service

services:
  hole-service:
    loadBalancer:
      servers:
        - url: http://11.23.24.1:3000

Solution

  • C:\config\traefik\traefik.yaml:

    entryPoints:
      hole-1:
        address: ":661"
    
    providers:
      file:
        filename: C:\config\traefik\dynamic.yaml
    

    C:\config\traefik\dynamic.yaml:

    http:
      routers:
        hole-router-1:
          rule: "Path(`/`)"
          entryPoints:
            - hole-1
          service: hole-service
    
      services:
        hole-service:
          loadBalancer:
            servers:
              - url: http://10.23.24.10:3000
    

    I started Traefik with: traefik.exe --configFile=C:/config/traefik/traefik.yaml