Docker 带nip.io的Traefik
我正在尝试使用traefik和nip.io公开一些应用程序 我的docker compose文件如下所示Docker 带nip.io的Traefik,docker,docker-compose,traefik,jwilder-nginx-proxy,Docker,Docker Compose,Traefik,Jwilder Nginx Proxy,我正在尝试使用traefik和nip.io公开一些应用程序 我的docker compose文件如下所示 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:
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"
但我没能找到我的服务
$ curl -vvv whoami.127.0.0.1.nip.io
上面返回404,完整的详细输出为
$ 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
整个输出非常相似
$ 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⏎
$curl-vvv-H“主机:whoami.127.0.0.1.nip.io”localhost
*正在尝试:1:80。。。
*已连接到本地主机(::1)端口80(#0)
>GET/HTTP/1.1
>主持人:whoami.127.0.0.1.nip.io
>用户代理:curl/7.71.1
>接受:*/*
>
*将捆绑包标记为不支持多用途
值得注意的是,主机头与两个请求一起正确发送
使用jwilder/nginx代理时我也有同样的问题,但无论使用Traefik还是nginx,我在使用Kubernetes入口的nip.io时都没有问题
有人知道怎么回事吗
更新:这适用于我的朋友Mac和ubuntu虚拟机,但不适用于我的软呢帽盒
$ 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⏎