首页 > 解决方案 > Spring boot REST Services 仅允许通过 F5 负载均衡器访问

问题描述

我有一个在 2 个 Apache Tomcat 服务器(2 个实例)上运行的 Spring Boot REST 服务。另外,我有一个 F5 负载平衡器配置为在 2 个 tomcat 服务器实例之间转发请求。

实际的:

https://f5-host/api/example --> working HTTP: 200
https://tomcat-host1/api/example --> working HTTP: 200
https://tomcat-host2/api/example --> working HTTP: 200

问题是我建议在通过 tomcat 服务器直接访问服务时进行代码更改以限制访问。我认为这可以通过 Apache Tomcat 服务器中的配置直接实现。有人可以在这里建议最好的方法/配置细节吗?

预期的:

https://f5-host/api/example --> working HTTP: 200
https://tomcat-host1/api/example --> Access Denied HTTP: 403
https://tomcat-host2/api/example --> Access Denied HTTP: 403

标签: spring-boottomcatload-balancing

解决方案


推荐阅读