• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Tomcat 7 - RemoteAddrValve comma separated IP Address Failure

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

When I put into my server.xml the line below all works fine & I can access my server from that specified ip address.

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="111\.222\.333\.444" />


However if I want to allow multiple IP Address by seperating with a comma (as per the tomcat 7 docs), say for example like this:

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="111\.222\.333\.444, 127\.0\.0\.1" /> it does NOT work.

This means I cannot access my server from even my localhost machine or the ip address specified.
If I have just 1 entry, it works fine. but multiple entries fail.

any help on this??

thanks!
 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've searched google for about an hour and can't find anyone who will just give a simple answer to this question. I finally found it by accident... in Tomcat 7 it's no longer separated by commas. It's pipe | separated and I didn't have to use any back slashes. Not sure why I'm seeing that everywhere but there is probably a reason.

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="192.168.1.3|192.168.1.4" deny="" />
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Josh Grabarek wrote: Not sure why I'm seeing that everywhere but there is probably a reason.



Yes, there's a reason. Actually this is a regex form. If not escaped by backslash, a .(dot) matches every single character.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!