9

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.)

18

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

In your case just add (or uncoment) "[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"
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.