You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tony Tomcat <to...@gmail.com> on 2005/08/16 16:14:33 UTC

org.apache.catalina.valves.RemoteHostValve issue

Does the RemoteHostValve work?   There are no examples in the Tomcat 5
docs and the tomcat 4 docs have the following..

 <Valve className="org.apache.catalina.valves.RemoteHostValve"
         allow="*.mycompany.com,www.yourcompany.com"/>

Any regex starting with * fails in Tomcat 5 and you can also see this
happen on the Regex test applet.

http://jakarta.apache.org/regexp/applet.html

Does anyone have some working examples?  It doesn't work for me even
if I type in the full hostname.   Perhaps there is something in Tomcat
I need to configure for it to be able to get the hostname of the
requestor?

Tony

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: org.apache.catalina.valves.RemoteHostValve issue

Posted by Mark Thomas <ma...@apache.org>.
Tony Tomcat wrote:
> Does the RemoteHostValve work?   There are no examples in the Tomcat 5
> docs and the tomcat 4 docs have the following..
> 
>  <Valve className="org.apache.catalina.valves.RemoteHostValve"
>          allow="*.mycompany.com,www.yourcompany.com"/>

The docs have been updated for 4 and 5 not to use this example.

The problem is that . is a special character in a regular expression 
and needs to be escaped if you want to match a single . character in 
your input.

The regexp docs are the place to read up on this.

The following should work but I haven't tried it.

   <Valve className="org.apache.catalina.valves.RemoteHostValve"
           allow=".*mycompany\.com,www\.yourcompany\.com"/>

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org