英文:
Spring Boot Restricit for Local Access
问题
我有一个运行在 Nginx 后面的 Spring Boot 应用程序,并将一组 API 作为 https 服务公开。我的安全团队要求我确保 Spring Boot 应用程序运行的端口(假设是 8080)只能通过 NGINX 进行接口交互,人们不能绕过 NGINX 直接访问该服务。
其中一种方法是安装本地防火墙,并阻止该端口(8080)的访问。
在 Spring Boot 中是否有任何方法可以确保它只能通过 localhost 或 127.0.0.1 进行接口交互和访问?
英文:
I have a Spring Boot application behind Nginx and exposes a set of APIs as a https service. My security team has asked me to make sure that the port the Spring Boot application runs on (let's say 8080) is only interfaced via NGINX and people cannot bypass NGINX and directly access the service.
One way to do this is to have a local firewall installed and block the port (8080).
Is there anything within Spring Boot to make sure it is interfaced and accessed via localhost or 127.0.0.1 only?
答案1
得分: 0
你可以在application.properties中使用server.address
将服务器绑定到仅限于 127.0.0.1。
英文:
You can use server.address
in application.properties to bind the server to 127.0.0.1 only.
See https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#server-properties for reference.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论