Simple reverse proxy with Traefik
18,621
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"
Related videos on Youtube
![lepe](https://i.stack.imgur.com/ctXYp.png?s=256&g=1)
Author by
lepe
I work as a server administrator / developer in Japan. I also assist some companies to strengthen their network security as freelancer.
Updated on September 18, 2022Comments
-
lepe almost 2 years
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 about 7 yearsSo [file] is required? I didn't find anything about that. Why its so?
-
Benjamin OLIVIER about 7 yearsyes it is if you simply want to manually create rules statically in a configuration file. You can refer to the doc: https://docs.traefik.io/toml/#file-backend
-
lepe about 7 yearsok. got it. Thanks! (do you mind to upvote my question? not sure why it was downvoted)
-
andig over 6 yearsGood question- was stuck there for an hour...
-
SeanDowney about 6 yearsUpdated Doc link: docs.traefik.io/configuration/backends/file