Spring Boot 本地访问限制

huangapple go评论71阅读模式
英文:

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。

详见 https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#server-properties 获取参考信息。

英文:

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.

huangapple
  • 本文由 发表于 2020年9月24日 19:58:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/64045948.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定