使用 HTTPS 在 Apache Ignite 中访问 REST API

Accessing REST API in Apache Ignite Using HTTPS

I am using Apache Ignite 2.8.0. This is my server configuration,

<property name="sslContextFactory">
    <bean class="org.apache.ignite.ssl.SslContextFactory">
        <property name="keyStoreFilePath" value="C:\ignite\apache-ignite-2.8.0-bin\keystore.jks"/>
        <property name="keyStorePassword" value="1234567"/>
        <property name="trustStoreFilePath" value="C:\ignite\\apache-ignite-2.8.0-bin\\trust.jks"/>
        <property name="trustStorePassword" value="123456"/>
    </bean>
</property> 
<property name="connectorConfiguration">

              <bean class="org.apache.ignite.configuration.ConnectorConfiguration">

                    <property name="jettyPath" value="C:\apache-ignite-2.8.0-bin\examples\config\jetty-config.xml" />

              </bean>

        </property>

And This is My jetty-config.xml, https://apacheignite.readme.io/docs/rest-api (Copy pasted)

Still it works with HTTP only.. It doesn't work with HTTPS. What is wrong with me? How I can enable the HTTPS on Rest API?

很遗憾,documentation snippet 不完整。

您还需要在码头配置中定义 sslContextFactory:

<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
    <Set name="keyStorePath">src/test/keystore/server.jks</Set>
    <Set name="keyStorePassword">123456</Set>
    <Set name="keyManagerPassword">123456</Set>
    <Set name="trustStorePath">src/test/keystore/trust-one.jks</Set>
    <Set name="trustStorePassword">123456</Set>
</New>

您还需要一个不同配置的连接器:

<Call name="addConnector">
    <Arg>
        <New class="org.eclipse.jetty.server.ServerConnector">
            <Arg><Ref refid="Server"/></Arg>
            <Arg>
                <Array type="org.eclipse.jetty.server.ConnectionFactory">
                    <Item>
                        <New class="org.eclipse.jetty.server.SslConnectionFactory">
                            <Arg><Ref refid="sslContextFactory"/></Arg>
                            <Arg>http/1.1</Arg>
                        </New>
                    </Item>
                    <Item>
                        <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                            <Arg><Ref refid="httpCfg"/></Arg>
                        </New>
                    </Item>
                </Array>
            </Arg>
  ...

您还需要信任库和签名的服务器密钥。生成那些,尤其是那些可能被网络浏览器接受的,超出了这个答案的范围。试试 letsencrypt 来生成这些,也许吧。