限制访问特定的网址(的Apache Tomcat) [英] Restrict access to specific URL (Apache Tomcat)

查看:169
本文介绍了限制访问特定的网址(的Apache Tomcat)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能限制访问特定的网址(这是一个Tomcat应用服务器)?例如的http://本地主机:8081 /应用程序不能由用户除指定的IP(即调用服务)访问

How can I restrict access to a specific URL (it is a Tomcat Application Server)? e.g. http://localhost:8081/application cannot be accessed by an user except a specified IP (that is the calling service)

推荐答案

报价:

远程地址过滤,org.apache.catalina.valves.RemoteAddrValve,允许你对一个或多个正前pressions比较请求的客户端的IP地址来允许或prevent从请求基于此比较的结果继续进行。远程地址过滤器可与Tomcat引擎,主机或上下文容器有关。
  org.apache.catalina.valves.RemoteAddrValve。

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.

<一个href=\"http://www.oxxus.net/tutorials/tomcat/tomcat-valve.htm\">http://www.oxxus.net/tutorials/tomcat/tomcat-valve.htm

所以,你需要沿着东西线

So, you'd need something along the lines of

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

有关可能的值,见

<一个href=\"http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Remote_Address_Filter\">http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Remote_Address_Filter

您应该能够设置这个在WEB-INF / web.xml中为应用程序,请参见

You should be able to set this in the WEB-INF/web.xml for your application, see

<一个href=\"http://oreilly.com/java/archive/tomcat.html\">http://oreilly.com/java/archive/tomcat.html

这篇关于限制访问特定的网址(的Apache Tomcat)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆