gpt4 book ai didi

apache - 限制对特定 URL 的访问 (Apache Tomcat)

转载 作者:行者123 更新时间:2023-11-28 21:50:46 24 4
gpt4 key购买 nike

如何限制对特定 URL 的访问(它是一个 Tomcat 应用程序服务器)?例如http://localhost:8081/application 不能被指定IP以外的用户访问(即调用服务)

最佳答案

引用:

The Remote Address filter, org.apache.catalina.valves.RemoteAddrValve, allows you to compare the IP address of the requesting client against one or more regular expressions to either allow or prevent the request from continuing based on the results of this comparison. A Remote Address filter can be associated with a Tomcat Engine, Host, or Context container. org.apache.catalina.valves.RemoteAddrValve.

http://www.oxxus.net/tutorials/tomcat/tomcat-valve.htm

所以,你需要一些类似

的东西
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="<your-ip-here>"/>

有关可能的值,请参阅

http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Remote_Address_Filter

您应该能够在您的应用程序的 WEB-INF/web.xml 中设置它,请参阅

http://oreilly.com/java/archive/tomcat.html

关于apache - 限制对特定 URL 的访问 (Apache Tomcat),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4850112/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com