I'm trying to expose some applications using traefik and nip.io
My docker-compose file looks as the following
version: '3.3'
services:
traefik:
image: traefik:1.7-alpine
command: --web --docker --docker.domain=app.test --logLevel=DEBUG
ports:
- 80:80
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
whoami:
image: tons/whoami-go
labels:
- "traefik.port=8080"
- "traefik.frontend.rule=Host:whoami.127.0.0.1.nip.io"
But I can't reach my service
$ curl -vvv whoami.127.0.0.1.nip.io
The above returns 404 and the complete verbose output is
$ curl -vvv whoami.127.0.0.1.nip.io
* Trying 127.0.0.1:80...
* Connected to whoami.127.0.0.1.nip.io (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: whoami.127.0.0.1.nip.io
> User-Agent: curl/7.71.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< Vary: Accept-Encoding
< X-Content-Type-Options: nosniff
< Date: Mon, 19 Apr 2021 12:07:29 GMT
< Content-Length: 19
<
404 page not found
* Connection #0 to host whoami.127.0.0.1.nip.io left intact
It works just fine when I do
$ curl -vvv -H "Host: whoami.127.0.0.1.nip.io" localhost
And the complete output is very similar
$ curl -vvv -H "Host: whoami.127.0.0.1.nip.io" localhost
* Trying ::1:80...
* Connected to localhost (::1) port 80 (#0)
> GET / HTTP/1.1
> Host: whoami.127.0.0.1.nip.io
> User-Agent: curl/7.71.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 12
< Content-Type: text/plain; charset=utf-8
< Date: Mon, 19 Apr 2021 12:12:13 GMT
<
* Connection #0 to host localhost left intact
49d197f2d4ae⏎
Notably the host header is sent correctly with both requests.
I have the same issue using jwilder/nginx-proxy but I have no problem when I'm using nip.io with Kubernetes ingress regardless of using Traefik or Nginx.
Anyone got a clue about what's wrong?
UPDATE: This works on my friends Mac and in an ubuntu VM, but not on my Fedora box
You can us the majic domain by configuring HostRegexp. eg : - "traefik.http.routers.app1.rule=HostRegexp(
app1.{ip:.*}.nip.io
)" Full details https://traefik.me