Nicholas DiPiazza
Nicholas DiPiazza

Reputation: 10595

Jetty - ipaccess per connector?

Let's say I am enabling the ipaccess module on jetty:

jetty-ipaccess.xml

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

<!-- =============================================================== -->
<!-- The IP Access Handler -->
<!-- =============================================================== -->

<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="insertHandler">
<Arg>
<New id="IPAccessHandler" class="org.eclipse.jetty.server.handler.IPAccessHandler">
    <Set name="white">
     <Array type="String">
     <Item>127.0.0.1</Item>
     <Item>192.168.1.168</Item>    
     </Array>
    </Set>
    <Set name="whiteListByPath">false</Set>
</New>
</Arg>
</Call>
</Configure>

Then I enable it with jetty/home/start.jar --add-to-start=ipaccess

But I want this filter to only apply to the http connector. I do not want it to apply to my https connector.

How do I configure it so that it only affects the http module, not the https module?

NOTE: In Jetty 10 this ipaccess module is replaced with another module:

https://github.com/eclipse/jetty.project/commit/3a4da94e1a69ee4c9cd3c936f50d58ee3440188e

Upvotes: 1

Views: 596

Answers (1)

Nicholas DiPiazza
Nicholas DiPiazza

Reputation: 10595

The answer is this is not yet possible because assigning an IPAccessHandler or InetAccessHandler is only possible when you use the programmatic version of jetty. Not when you are starting it with start.jar.

So I created issue: https://github.com/eclipse/jetty.project/issues/3562

I created a PR to fix this: https://github.com/eclipse/jetty.project/pull/3572

And gregw@github took it and extended upon it here https://github.com/eclipse/jetty.project/pull/3576

Once this is in a 9.4.x release I'll be all set.

Upvotes: 2

Related Questions