traefik - 使用 Traefik 的简单 http 反向代理总是产生 404
问题描述
我使用以下命令使用预构建的二进制文件(v1.6.4)启动了 Traefik:
./traefik_linux-amd64 --configFile=traefik.toml
traefik.toml 文件:
defaultEntryPoints = ["http"]
[entryPoints]
[entryPoints.http]
address = ":11111"
[backends]
[backends.abcd]
[backends.abcd.servers]
[backends.abcd.servers.server0]
url = "http://10.0.3.192:80"
[frontends]
[frontends.frontend1]
backend = "abcd"
[frontends.frontend1.routes.abcd]
rule = "Path:/abcd"
卷曲http://localhost:11111/abcd -v
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 11111 (#0)
> GET /abcd HTTP/1.1
> Host: localhost:11111
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Mon, 25 Jun 2018 02:00:27 GMT
< Content-Length: 19
<
404 page not found
* Connection #0 to host localhost left intact
服务在http://10.0.3.192:80(在 lxc 容器内)运行,如果我直接 curl: curl http://10.0.3.192 -v
* Rebuilt URL to: http://10.0.3.192/
* Trying 10.0.3.192...
* Connected to 10.0.3.192 (10.0.3.192) port 80 (#0)
> GET / HTTP/1.1
> Host: 10.0.3.192
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 25 Jun 2018 01:58:12 GMT
< Content-Length: 34
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host 10.0.3.192 left intact
<snip / garbage out>
我应该对配置文件做些什么不同的事情?
编辑:解决。看评论。
解决方案
推荐阅读
- caching - 上下文切换:如果新进程的虚拟内存映射到与前一个进程相同的物理地址,内存保护是如何实现的?
- http - Linux 上的 Telnet - 我可以将 Transfer-encoding: chunked 设置为 GET 选项吗?
- google-cloud-platform - 使用 Cloud Functions 启动/停止 Google Cloud SQL 实例
- two-factor-authentication - 如何在烧瓶安全中跳过 tfa 设置阶段
- r - 如何将 .Rnw 文件编织到乳胶中,并将绘图作为 tikzpicture 环境?(错误:由多个实际参数匹配的形式参数)
- javascript - Jest 全局设置导致不一致的测试通过/失败
- ios - iOS 搜索栏与导航栏混淆
- python - 没有副作用类型注释的可迭代
- c++ - 'operator++(int) &' 运算符重载中的 '&' 是什么意思?
- flutter - 如何在扫描渐变中包含笔画帽?