title: How to allow multiple IP address with Tomcat?
body: <p>I'm trying to block all traffic within Tomcat except two ips.
  I found out that I can do that within the server.xml file, so I have this:</p>
  
  <pre><code>  &lt;Host name="localhost"  appBase="webapps"
          unpackWARs="true" autoDeploy="true"&gt;
  
      &lt;!-- SingleSignOn valve, share authentication between web applications
           Documentation at: /docs/config/valve.html --&gt;
      &lt;!--
      &lt;Valve className="org.apache.catalina.authenticator.SingleSignOn" /&gt;
      --&gt;
  
      &lt;!-- Access log processes all example.
           Documentation at: /docs/config/valve.html
           Note: The pattern used is equivalent to using pattern="common" --&gt;
      &lt;Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
             prefix="localhost_access_log" suffix=".txt"
             pattern="%h %l %u %t &amp;quot;%r&amp;quot; %s %b" /&gt;
      &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="192.168.1.2" /&gt;
    &lt;/Host&gt;
  </code></pre>
  
  <p>This is working, but now I want that there are two ip's allowed, so I tried the following two options that I found on internet:</p>
  
  <pre><code>    &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="192.168.1.2,192.168.1.22" /&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="192\.168\.1\.\2|192\.168\.1\.22" /&gt;
  </code></pre>
  
  <p>But both are not working, what am I doing wrong here?</p>
  
  <p>I'm using Tomcat version 8.5.46.0 on Red Hat.</p>