Tomcat 7 RemoteHostValve not working for localhost

1.1k views Asked by At

I am trying to restrict access to a Tomcat 7 Server by using this valve: org.apache.catalina.valves.RemoteHostValve.

It's working fine for other hosts, but I can not access the server locally by using the localhost (http://localhost:8080).

Here is the Valve:

<Valve className="org.apache.catalina.valves.RemoteHostValve" allow="host2.xy.i|host2.xy.i|localhost"/>

Any ideas?

1

There are 1 answers

4
Radon8472 On

for this function Hostname Lookups are needet. Did you check that you have set ?

<Connector enableLookups="true" />

If its not working with the Hostname, you could reach the same result with:

<Valve className="org.apache.catalina.valves.RemoteAddrValve"
    allow="127\..*"/>

But check if you have localhost V6 IP, this example matches only ipv4