I'm trying to force Jetty to only use HTTPS (or redirect to HTTPS from HTTP).
So far, I can access the server using both HTTP and HTTPS.
Here's the connector configuration:
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="port"><SystemProperty name="jetty.port" default="8888"/></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">1000</Set>
<Set name="lowResourcesMaxIdleTime">500</Set>
</New>
</Arg>
</Call>
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.security.SslSocketConnector">
<Set name="Port">8443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="handshakeTimeout">2000</Set>
<Set name="keystore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
<Set name="password">aaa</Set>
<Set name="keyPassword">bbb</Set>
<Set name="truststore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
<Set name="trustPassword">aaa</Set>
<Set name="handshakeTimeout">2000</Set>
</New>
</Arg>
</Call>
I've tried setting the default port as 8443 (in the first connector), that didn't work and generated an error.
Remove the first <Call name="addConnector">
section, that's the one that adds the plain HTTP connector (org.mortbay.jetty.nio.SelectChannelConnector
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With