如何在Tomcat中限制源IP对某些URL的访问? [英] How can I restrict access to certain URLs by source IP in Tomcat?

查看:1546
本文介绍了如何在Tomcat中限制源IP对某些URL的访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想限制对Tomcat webapp中某些网址的访问。
只允许3个已知的IP地址访问符合特定模式的URL。

I want to restrict access to certain URLs in my Tomcat webapp. Only 3 known IP addresses should be allowed access to URLs that fit a certain pattern.

例如。 http://example.com:1234/abc/personId

我如何实现这一目标?

推荐答案

使用org.apache.catalina.filters.RemoteAddrFilter并将其映射到您要保护的URL。请参阅 http://tomcat.apache.org/tomcat-7.0-doc/config/filter .html#Remote_Address_Filter 了解配置详情。

Use org.apache.catalina.filters.RemoteAddrFilter and map it to the URL you wish to protect. See http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#Remote_Address_Filter for configuration details.

这篇关于如何在Tomcat中限制源IP对某些URL的访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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