微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ConfidentialPort和SecurePort for Jetty有什么区别

如何解决ConfidentialPort和SecurePort for Jetty有什么区别

我正在尝试启用Jetty的https端口。 Jetty在Karaf服务器中运行。

虽然在网上找到了不同的建议配置:

  • https://karaf.apache.org/manual/latest/的版本

      <!-- Use this connector for many frequently idle connections and for
         threadless continuations. -->
     <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="8181" />
                 </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>
    
  • https://www.eclipse.org/jetty/documentation/9.1.5.v20140505/configuring-connectors.html的另一个版本

     <New id="tlsHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
         <Arg>
             <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
                 <Set name="secureScheme">https</Set>
                 <Set name="securePort">
                     <Property name="jetty.tls.port" default="8443"/>
                 </Set>
                 <Set name="outputBufferSize">32768</Set>
                 <Set name="requestHeaderSize">8192</Set>
                 <Set name="responseHeaderSize">8192</Set>
    
                 <!-- Uncomment to enable handling of X-Forwarded- style headers
                 <Call name="addCustomizer">
                     <Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
                 </Call>
                 -->
             </New>
         </Arg>
         <Call name="addCustomizer">
             <Arg>
                 <New class="org.eclipse.jetty.server.SecureRequestCustomizer"/>
             </Arg>
         </Call>
    

我没有两种工作方法。您是否有关于如何调试此问题以及实际上正确的方法的任何提示

解决方法

对于稳定版本(非EOL)的Jetty,例如Jetty 9.4.x ...

HttpConfiguration.securePortServerConnector上存在的配置)是逻辑端口,用于标识对您的客户端公开可见的安全端口。

以这个用例为例。

  1. 公共Internet上的浏览器请求https://acme.com/foo
  2. 浏览器为acme.com查找DNS并获取210.1.1.1
  3. 浏览器在端口210.1.1.1上连接到443
  4. 负载均衡器/代理正在监听210.1.1.1:443并接受请求。
  5. Load Balancer添加了Forwarding标头并连接到内部IP 10.2.2.2:8443
  6. 10.2.2.2:8443上侦听的Jetty服务器接受连接并处理请求。

这时,Jetty服务器上的配置在端口ServerConnector上有一个8443,端口HttpConfiguration.securePort的值是443,因为这是公用端口浏览器看到的。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?