【问题标题】:Traefik 2.2 Gateway timeout issueTraefik 2.2 网关超时问题
【发布时间】:2020-08-27 14:18:13
【问题描述】:

我一直在尝试使用基本的官方指南设置 traefik v2.2。我有一个 Spring Boot 服务,我已经容器化并且工作正常。

这是我的 Spring Boot 服务的 docker compose:

version: "3"

services:
  spring-boot-traefik-app:
    image: spring-boot-traefik-example:latest
    labels:
      - "traefik.http.routers.spring-boot-traefik-app.rule=Host(`springboot.traefik.app`)"

这是我的 Traefik docker compose :

version: "3"

services:
  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.2
    # Enables the web UI and tells Traefik to listen to docker
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
    ports:
      # The HTTP port
      - "80:80"
      # The Web UI (enabled by --api.insecure=true)
      - "8080:8080"
    volumes:
      # So that Traefik can listen to the Docker events
      - /var/run/docker.sock:/var/run/docker.sock

现在,我正在尝试通过以下方式发出 curl 请求:

curl -H Host:springboot.traefik.app http://127.0.0.1

由于我只是在上下文路径“/”上返回服务信息,它应该返回给我一些东西。服务独立工作正常。但是当我尝试在代理后面运行时,它会给我网关超时错误。我不确定 traefik 是否正常工作。我错过了什么吗?官方指南使用 whoami 图像,这是我试图用 Spring boot 创建的。此外,traefik 仪表板可以正确显示详细信息。

【问题讨论】:

  • 嗨,你最终解决了这个问题吗?我有同样的问题。使用文件配置和 springboot 应用程序,只需获得网关超时。
  • 嘿@Dan,我找不到解决方案。幸运的是,这是我最喜欢的项目,旧版 Traefik 运行良好

标签: spring-boot docker docker-compose traefik


【解决方案1】:

也许您应该为您的 traefik 配置定义一个入口点。你可能没有 traefik.toml 文件(我个人更喜欢使用它)。无论如何,您应该为您的 traefik 容器添加命令 --entryPoints.web.address=:80 并在您的 springboot 容器中添加标签 traefik.http.routers.spring-boot-traefik-app.entrypoints=web。我希望它有效!

【讨论】:

  • 我已经尝试过了,但它不起作用。网关超时
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-20
  • 2019-07-11
  • 2018-03-23
  • 2011-07-29
  • 2017-04-03
  • 1970-01-01
相关资源
最近更新 更多