Skip to content

Jetty

IPAccessHandler

jetty-ipaccess.xml파일 내용은 아래와 같다.

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<!-- =============================================================== -->
<!-- Mixin the Statistics Handler                                    -->
<!-- =============================================================== -->


<Configure id="Server" class="org.eclipse.jetty.server.Server">

    <Get id="oldhandler" name="handler"/>

    <Set name="handler">
     <New id="IPAccessHandler" class="org.eclipse.jetty.server.handler.IPAccessHandler">
      <Set name="handler"><Ref id="oldhandler"/></Set>
      <Set name="white">
        <Array type="String">
      <Item>127.0.0.1</Item>
      <Item>127.0.0.2/*.html</Item>
    </Array>
      </Set>
      <Set name="black">
        <Array type="String">
      <Item>127.0.0.1/blacklisted</Item>
      <Item>127.0.0.2/black.html</Item>
    </Array>
      </Set>
     </New>
    </Set>

</Configure>

Examples of the entry specifications are:

  • 10.10.1.2 - all requests from IP 10.10.1.2
  • 10.10.1.2|/foo/bar - all requests from IP 10.10.1.2 to URI /foo/bar
  • 10.10.1.2|/foo/* - all requests from IP 10.10.1.2 to URIs starting with /foo/
  • 10.10.1.2|*.html - all requests from IP 10.10.1.2 to URIs ending with .html
  • 10.10.0-255.0-255 - all requests from IPs within 10.10.0.0/16 subnet
  • 10.10.0-.-255|/foo/bar - all requests from IPs within 10.10.0.0/16 subnet to URI /foo/bar
  • 10.10.0-3,1,3,7,15|/foo/* - all requests from IPs addresses with last octet equal to 1,3,7,15 in subnet 10.10.0.0/22 to URIs starting with /foo/

See also