jetty.project
jetty.project copied to clipboard
how define more than on ssl connector in jetty 12?
Jetty Version 12 Jetty Environment ee10
Java Version
21
Question
I have upgraded my project from jetty 9 to 12,
In the Jetty 9 server, we had We have more than one ssl connector in jetty.xml file, As you can see below:
<Call id="httpsConnector" name="addConnector">
<Arg>
<New id="ssl" class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.SslConnectionFactory">
<Arg name="sslContextFactory"><Ref refid="chmailSslContextFactory" /></Arg>
<Arg name="next">http/1.1</Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host"></Set>
<Set name="port">8443</Set>
<Set name="idleTimeout">60000</Set>
</New>
</Arg>
</Call>
<Call id="adminHttpsConnector" name="addConnector">
<Arg>
<New id="admin" class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.SslConnectionFactory">
<Arg name="sslContextFactory"><Ref refid="chmailSslContextFactory" /></Arg>
<Arg name="next">http/1.1</Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host"></Set>
<Set name="port">7074</Set>
<Set name="idleTimeout">0</Set>
</New>
</Arg>
</Call>
I have read in the Jetty 12 documents that ServerConnector should be instantiate in jetty-ssl.xml file and its ConnectionFactories should be configured in jetty-https.xml file.
But there is no mention of how they would be configured if we had more than one ssl connector.
How to define several ConnectionFactories in jetty-https.xml file and connect them to several ServerConnectors in jetty-ssl.xml file
You should not change the Jetty module XML files that come with Jetty, as this would be a maintenance nightmare when the Jetty project updates them.
Instead, create a new module, say admin-https.mod, as described here:
https://jetty.org/docs/jetty/12/operations-guide/modules/custom.html
Make this new module depend on https (so that it will be processed after), and add an admin-https.xml file with just the second part of your XML above.
I have read in the Jetty 12 documents that ServerConnector should be instantiate in jetty-ssl.xml file and its ConnectionFactories should be configured in jetty-https.xml file.
I don't think this is correct. Where exactly did you read the above?
After you have created your custom admin-https module, you just add it to your $JETTY_BASE via:
java -jar $JETTY_HOME/start.jar --add-modules=admin-https
and you should be good.
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing as answered.