配置远程地址过滤器

时间:2016-07-08 13:27:09

标签: tomcat

如何在属性'allow'中添加外部地址(即10.23.45.12):

 <filter>
            <filter-name>Remote Address Filter</filter-name>
            <filter-class>org.apache.catalina.filters.RemoteAddrFilter</filter-class>
            <init-param>
                <param-name>allow</param-name>
                <param-value>127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1</param-value>                   
            </init-param>
        </filter>

1 个答案:

答案 0 :(得分:0)

只需将其添加到正则表达式(您需要转义点):

<init-param>
    <param-name>allow</param-name>
    <param-value>127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|10\.23\.45\.12</param-value>    
</init-param>