jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

how define more than on ssl connector in jetty 12?

Open fgolzari opened this issue 1 year ago • 1 comments
trafficstars

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

fgolzari avatar Jul 29 '24 06:07 fgolzari

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.

sbordet avatar Jul 29 '24 06:07 sbordet

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.

github-actions[bot] avatar Aug 22 '25 00:08 github-actions[bot]

Closing as answered.

sbordet avatar Aug 22 '25 16:08 sbordet