禁用基于主机名的Swagger – Spring

huangapple 未分类评论48阅读模式
英文:

Disable swagger by hostname - Spring

问题

有没有可能根据请求的主机名(动态IP)在基于Spring的应用程序中对Swagger资源设置安全性。目前我正在使用 @Profile 注解在生产环境中禁用Swagger,但我想在我的生产服务中使用Swagger。我可以从两个主机名访问此服务。一个是公共的,另一个是受VPN保护的内部地址。我想在内部地址上看到Swagger UI,但我需要拒绝来自公共地址的访问。有什么建议吗?谢谢。

英文:

is there any possibility to set security on swagger resources in Spring application based on the requested hostname (dynamic IP). Now I am using @Profile annotation to disable swagger in production, but I want to use swagger for my production service. I can access this service from two hostnames. One is public, the other is internal and secured by a VPN. I want to see swagger UI on internal address but I need to reject access from the public. Any suggestion? Thanks.

huangapple
  • 本文由 发表于 2020年5月5日 16:58:50
  • 转载请务必保留本文链接:https://java.coder-hub.com/61609419.html
匿名

发表评论

匿名网友

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

确定