Spring boot Spring boot REST服务仅允许通过F5负载平衡器进行访问

Spring boot Spring boot REST服务仅允许通过F5负载平衡器进行访问,spring-boot,tomcat,load-balancing,Spring Boot,Tomcat,Load Balancing,我在2台ApacheTomcat服务器(2个实例)上运行Spring引导REST服务。此外,我还配置了一个F5负载平衡器,用于在两个tomcat服务器实例之间转发请求 实际值: https://f5-host/api/example --> working HTTP: 200 https://tomcat-host1/api/example --> working HTTP: 200 https://tomcat-host2/api/example --> working HT

我在2台ApacheTomcat服务器(2个实例)上运行Spring引导REST服务。此外,我还配置了一个F5负载平衡器,用于在两个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
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
问题是,我建议在通过tomcat服务器直接访问服务时,执行代码更改以限制访问。我认为这可以通过ApacheTomcat服务器中的配置直接实现。有人能在这里建议最好的方法/配置细节吗

期望值:

https://f5-host/api/example --> working HTTP: 200
https://tomcat-host1/api/example --> working HTTP: 200
https://tomcat-host2/api/example --> working HTTP: 200
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 Boot版本?Spring Boot 2.1.8版本