【问题标题】:How to avoid redirecting to SSL port如何避免重定向到 SSL 端口
【发布时间】:2013-01-16 14:19:17
【问题描述】:

我的 SSL 配置 Web 应用程序中的 Web.xml 配置(部署在 tomcat(8080 端口)上)如下

<security-constraint>
    <web-resource-collection>
        <web-resource-name>HTTPSOnly</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

当我尝试https://google.com 时,我得到了页面 当我尝试 http://google.com 时,它会自动重定向到 https://google.com:8443。所以我没有得到页面。

我希望它被重定向到https://google.com 而不是https://google.com:8443

请帮助我。如果您需要更多详细信息,会告诉您。

【问题讨论】:

  • 示例为 google.com,因为它不允许我添加虚拟域名

标签: web-applications ssl ssl-certificate tomcat6 web.xml


【解决方案1】:

我明白了。 从 tomcat 的 server.xml 中移除 SSL redirectPort

<Connector port="8080" protocol="HTTP/1.1" 
connectionTimeout="20000" redirectPort="8443" />

喜欢,

<Connector port="8080" protocol="HTTP/1.1" 
connectionTimeout="20000" />

【讨论】:

  • 所以您现在正在重定向到端口 443 上的 HTTPS 连接器?
  • @EJP 现在它重定向到HTTPS://localhost 而不是HTTPS://localhost:8443
  • 实际上它会将您重定向到localhost:443。由于这是默认的 https 端口,因此浏览器不会显示。如果您的 server.xml 在 8443(或除 443 之外的任何其他内容)上定义了 https 连接器,这仍然无法正常工作。
猜你喜欢
  • 1970-01-01
  • 2014-08-13
  • 1970-01-01
  • 1970-01-01
  • 2014-12-02
  • 1970-01-01
  • 2011-11-24
  • 2014-05-26
  • 2015-06-17
相关资源
最近更新 更多