3

I am trying to configure the jetty to work with SSL in Apache Karaf OSGI container. http works, but https does not work. What could be the problem?

My configuration details below:

etc/jetty.xml

<Call name="addConnector">
    <Arg>
        <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
            <Set name="host">
                <Property name="jetty.host" />
            </Set>
            <Set name="port">
                <Property name="jetty.port" default="8282" />
            </Set>
            <Set name="maxIdleTime">300000</Set>
            <Set name="Acceptors">2</Set>
            <Set name="statsOn">false</Set>
            <Set name="confidentialPort">8443</Set>
            <Set name="lowResourcesConnections">20000</Set>
            <Set name="lowResourcesMaxIdleTime">5000</Set>
        </New>
    </Arg>
</Call>
<Call name="addConnector">
 <Arg>
   <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
     <Arg>
       <New class="org.eclipse.jetty.http.ssl.SslContextFactory">
         <Set name="KeyStore">/opt/keystore</Set>
    <Set name="KeyStorePassword">password</Set>
    <Set name="KeyManagerPassword">password</Set>
    <Set name="TrustStore">/opt/keystore</Set>
    <Set name="TrustStorePassword">password</Set>
       </New>
     </Arg>
     <Set name="port">8443</Set>
     <Set name="maxIdleTime">30000</Set>
   </New>
 </Arg>

entry in /etc/org.ops4j.pax.web.cfg file

org.ops4j.pax.web.config.file=${karaf.home}/etc/jetty.xml
Donald_W
  • 1,773
  • 21
  • 35
Srikanth Hugar
  • 385
  • 5
  • 22

1 Answers1

7

To enable SSL, you just need to enable it by using the httpService configuration. For this edit the etc/org.ops4j.pax.web.cfg and add/alter the following entries.

org.osgi.service.http.secure.enabled=true

more details on how to configure Pax Web and the httpService can be found at the official dokumentation, or the integration tests

Achim Nierbeck
  • 5,265
  • 2
  • 14
  • 22