用于在一个公共端口上映射多个上下文路径的 ALB (tomcat)
ALB to map multiple context path on one common port (tomcat)
目前,我们有基于 tomcat 的部署和一台 Apache 服务器来管理同一端口上的多个上下文路径(v-host 配置)
例如,
ProxyPassMatch /test(.) http://127.0.0.1:7077/test$1*
ProxyPassMatch /test2(.) http://127.0.0.1:7077/test2$1*
等等
现在我们正在转向 AWS 的 ALB,我们希望在 Apache 配置文件中映射 ALB 中的所有上下文路径。
我们创建了ALB --> 80 端口上的侦听器 --> 使用端口 7077 的必要实例创建的目标 --> 健康检查通过
侦听器规则是,
Context path /test --> Forward to Target Group of 7077 port
Context path /test2 --> Forward to Target Group of 7077 port
但是在测试时,当我们关闭 Apache 并测试 ALB 时它显示 502 Bad Gateway
任何解决方案?
Application Load Balancer 无法像使用典型的反向代理那样重写到达目标的路径。
The path pattern is used to route requests but does not alter them. For example, if a rule has a path pattern of /img/*, the rule would forward a request for /img/picture.jpg to the specified target group as a request for /img/picture.jpg.
Tomcat具体:
也许您可以让 tomcat 应用通过 context.xml
或 server.xml
中的配置监听多个路径。这个 question 有一些建议,但似乎如果你有多个上下文,应用程序将 运行 两次并占用两倍的内存。
目前,我们有基于 tomcat 的部署和一台 Apache 服务器来管理同一端口上的多个上下文路径(v-host 配置)
例如,
ProxyPassMatch /test(.) http://127.0.0.1:7077/test$1*
ProxyPassMatch /test2(.) http://127.0.0.1:7077/test2$1*
等等
现在我们正在转向 AWS 的 ALB,我们希望在 Apache 配置文件中映射 ALB 中的所有上下文路径。
我们创建了ALB --> 80 端口上的侦听器 --> 使用端口 7077 的必要实例创建的目标 --> 健康检查通过
侦听器规则是,
Context path /test --> Forward to Target Group of 7077 port
Context path /test2 --> Forward to Target Group of 7077 port
但是在测试时,当我们关闭 Apache 并测试 ALB 时它显示 502 Bad Gateway
任何解决方案?
Application Load Balancer 无法像使用典型的反向代理那样重写到达目标的路径。
The path pattern is used to route requests but does not alter them. For example, if a rule has a path pattern of /img/*, the rule would forward a request for /img/picture.jpg to the specified target group as a request for /img/picture.jpg.
Tomcat具体:
也许您可以让 tomcat 应用通过 context.xml
或 server.xml
中的配置监听多个路径。这个 question 有一些建议,但似乎如果你有多个上下文,应用程序将 运行 两次并占用两倍的内存。