I am trying Traefik. I am running e.g. voila at a port
$ voila --port=48900
...
[Voila] Voilà is running at:
http://localhost:48900/
and want to make it available from another port e.g. 8900 (when/if this works I plan to move its root to a path e.g. /voila/ and add some more services to paths, but trying to keep things simple here)
I am running Traefik with traefik_config.yaml being:
entryPoints:
http:
address: ":8900"
http:
routers:
boards:
rule: "Path(`/`)"
service: boards
services:
boards:
loadBalancer:
passHostHeader: true
servers:
- url: "http://localhost:48900"
and then run traefik with ./traefik --configFile=traefik_config.yaml
Traefik runs, but any call to http://localhost:8900/
returns 404 page not found
.
I checked and calls to http://localhost:48900/
return the correct page.
What is wrong? This seems the simplest proxy possible... How should I modify my config file?
Traefik's file-based configuration provider (the part that define routers, services, middlewares, etc) is separate from it's own config file (which defines things like access logging, which ports to listen on, entrypoints, etc).
In short, this will do for you:
on config.yaml
:
# this file contains only the "frontend" of traefik, where your clients will connect to
entryPoints:
http:
address: ":8900"
# define where to find your "backends"
providers:
file:
filename: voila.yaml
then, in a file named voila.yaml
(name matches above!)
# this file contains the backends, that traefik will route traffic to
http:
routers:
boards:
rule: "Path(`/`)"
service: boards
services:
boards:
loadBalancer:
passHostHeader: true
servers:
- url: "http://localhost:48900"
then invoke traefik as you were doing: ./traefik --configFile=config.yaml
Note: When testing this, I had to change localhost:48900
to 127.0.0.1:48900
, as localhost
is too broadly defined and different softwares take this in different ways. You'll know you've got the same problem if you start getting "Bad Gateway" errors after a few seconds. I didn't test it with Voila, though (I'm not familiar with it), and just used a dummy http server that I was 100% certain would work for me.