Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Restrict a single webapp to localhost

You can also bind to localhost only:
OPTIONS=--module=server,http jetty.host=localhost
should work for you(?)


On 15 April 2014 14:49, Thomas Scheffler <thomas.scheffler@xxxxxxxxxxx> wrote:
Am 11.02.2014 09:01, schrieb Thomas Scheffler:
Hi,

I have a single webapp that should only be accessible by request from
localhost (ipv4/ipv6). I am looking for a way to configure it in
WEB-INF/jetty-web.xml
I provide a file (META-INF/context.xml) for Tomcat, that looks like this:

<Context>
   <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
</Context>

Yet I was not successful achieving the same with jetty 9.1. Any help is
highly appreciated.

I found this solution in the deep of the web:

<!DOCTYPE Configure PUBLIC
    "-//Mort Bay Consulting//DTD Configure//EN"
    "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="handler">
    <New class="org.eclipse.jetty.server.handler.IPAccessHandler">
      <Call name="addWhite">
        <Arg>127.0.0.1</Arg>
      </Call>
      <Set name="handler">
         <!-- here's where you put what was there before: -->
        <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection" />
      </Set>
    </New>
  </Set>
</Configure>

It does something but sadly even forbids access from localhost. Any ideas?

kind regards,

Thomas
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top