Hi everyone,

I'm having a problem I haven't been able to address after reading the manual, 
googling and searching Stack Overflow, and asking around to other Tomcat users 
I know.


I'm using Tomcat 8.5.16, and trying to set up a RemoteHostFilter. When I start 
the application with the RemoteHostFilter, it fails to startup with the 
following stack trace:


Exception starting filter [Remote Host Filter] javax.servlet.ServletException: 
The property [allow] is not defined for filters of type 
[org.apache.catalina.filters.RemoteHostFilter]
    at org.apache.catalina.filters.FilterBase.init(FilterBase.java:52)
    at 
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
    at 
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
    at 
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
    at 
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590)
    at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
    at 
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

I see the allow property mentioned in both the user guide documentation (here: 
https://tomcat.apache.org/tomcat-8.5-doc/config/filter.html#Remote_Host_Filter) 
and the javadoc (here: 
https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html).
RemoteHostFilter (Apache Tomcat 8.5.29 API 
Documentation)<https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteHostFilter.html>
tomcat.apache.org
Extract the desired request property, and pass it (along with the specified 
request and response objects and associated filter chain) to the protected 
process ...




To troubleshoot, I set up a RemoteAddrFilter in my application's 
WEB-INF/web.xml using identical XML except for the value of the filter 
(obviously) and it works just fine.


Does anyone know what the "property [allow] is not defined" message means? I 
would intuit that it means there is no "allow" property at all in the 
RemoteHostFilter code, but I suppose it may also mean that the init-param xml 
tag is not the right one to use or that the value is unintelligible to Tomcat 
somehow.


Also, here's the relevant snippet from the web.xml, that I am trying to use:


<filter>
        <filter-name>Remote Host Filter</filter-name>
        
<filter-class>org.apache.catalina.filters.RemoteHostFilter</filter-class>
        <init-param>
            <param-name>allow</param-name>
            <param-value>*\.example\.com</param-value>
        </init-param>
        <init-param>
            <param-name>denyStatus</param-name>
            <param-value>404</param-value>
        </init-param>
    </filter>

    <filter-mapping>
      <filter-name>Remote Host Filter</filter-name>
      <url-pattern>/url/path</url-pattern>
    </filter-mapping>

Scott

Reply via email to