12

I'm currently using Apache as proxy for my LXD containers, using this kind of settings:

<VirtualHost *:80>
    ServerName example.com
    ProxyRequests off
    ProxyPass / http://10.0.0.142/ retry=0
    ProxyPassReverse / http://10.0.0.142/
    ProxyPreserveHost On
</VirtualHost>

I would like to switch to traefik. I have tried this configuration:

defaultEntryPoints = ["http"]
[entryPoints]
  [entryPoints.http]
  address = ":80"

[backends]
  [backends.backend1]
    [backends.backend1.servers.server1]
       url = "http://10.0.0.142"

[frontends]
  [frontends.frontend1]
      backend = "backend1"
      passHostHeader = true
      [frontends.frontend1.routes.example]
          rule = "Host:example.com"
  • Are these two equivalent?
  • Can the traefik configuration be simplified? (remove unnecessary rules)

(Note: I'm not planning on using docker, and I would prefer not to.)

lepe
  • 468
  • 1
  • 6
  • 23

1 Answers1

20

You are missing the backend type definition (file, Docker, Swarm...).

In your case just add (or uncomment) [file] in your conf file, like that:

defaultEntryPoints = ["http"]
[entryPoints]
  [entryPoints.http]
  address = ":80"

[file]

[backends]
  [backends.backend1]
    [backends.backend1.servers.server1]
       url = "http://10.0.0.142"

[frontends]
  [frontends.frontend1]
      backend = "backend1"
      passHostHeader = true
      [frontends.frontend1.routes.example]
          rule = "Host:example.com"
petres
  • 103
  • 2