Spring - 主机引用是HTTPS服务器上的HTTP

时间:2017-04-06 13:48:25

标签: java spring restlet

我有两个SpringServer服务器;

HTTP

<bean id="server" class="org.restlet.ext.spring.SpringServer">
    <constructor-arg value="http" />
    <constructor-arg value="${server.port}" />
    <property name="parameters">
        <props>
            <prop key="tracing">false</prop>
        </props>
    </property>
</bean>

HTTPS

<bean id="httpsServer" class="org.restlet.ext.spring.SpringServer">
  <constructor-arg value="https" />
  <property name="parameters">
    <props>
      <prop key="sslContextFactory">org.restlet.engine.ssl.DefaultSslContextFactory</prop>
      <prop key="keyStorePath">C:/store/ks.jks</prop>
      <prop key="keyStorePassword">pwd</prop>
      <prop key="keyPassword">pwd</prop>
      <prop key="keyStoreType">JKS</prop>
   </props>
 </property>
</bean>

然后我将这些服务器加载到SpringComponent

<bean id="component" class="org.restlet.ext.spring.SpringComponent">
 <property name="serversList">
    <list>
      <ref bean="server" />
      <ref bean="httpsServer"/>
    </list>
 </property>
 <property name="clientsList">
    <list>
     <value>file</value>
     <value>clap</value>
     <value>http</value>
     <value>https</value>
    </list>
 </property>
 <property name="defaultHost" ref="defaultHost" />
</bean>

我的问题是,即使我在http://localhost,主人引用始终为https。由于它具有内容安全策略,这会导致Chrome超时。

示例输出:

2017-04-06 15:27:38 0:0:0:0:0:0:0:1 - - 443 GET /client/app/partials/login.html - 200 1850 0 1 http:// localhost Mozilla /5.0(Windows NT 10.0; Win64; x64)AppleWebKit / 537.36(KHTML,与Gecko一样)Chrome / 57.0.2987.133 Safari / 537.36 https:// localhost / app / login

1 个答案:

答案 0 :(得分:0)

根据Restlet的change log,在旧版本上,这是由未正确注册的HTTPS服务器引起的。升级到restlet 2.3.9修复了问题。