首页 > 解决方案 > ProxyPass/ProxyPassReverse 与 Traefik

问题描述

我想在 Docker Swarm 中将 apache/tomcat ProxyPass 配置更改为 traefik/tomcat 配置。我在这里尝试了一些解释https://docs.traefik.io/basics/#frontends,但它不起作用:

阿帕奇配置:

ProxyPass       /sso ajp://server_host:8080/app
ProxyPassReverse    /sso ajp://server_host:8080/app

Docker Swarm 配置:

Traefik config in my docker-compose file:
traefik.frontend.rule=Host:external_dns;PathPrefix:/sso;ReplacePath:/app

以及带有战争应用程序的docker映像中的tomcat(上下文“app”)

但它不起作用,/sso被重定向(302)到/app

谁可以做从前端到后端的重定向?

谢谢

标签: dockertraefikswarm

解决方案


修改参数后问题解决ReplacePathRegex

traefik.frontend.rule=Host:external_dns;PathPrefix:/sso;ReplacePathRegex:^/sso/(.*) /app/$$1

推荐阅读