繁体   English   中英

HTTP到https重定向(tomcat / jboss)

[英]http to https redirect (tomcat/jboss)

我们想将所有来自应用程序http URL的流量重定向到https,为此,我们在deploy / jboss-web.deployer / conf目录的web.xml中设置以下值。

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

这确实将用户成功重定向到https位置,但是他们使用的端口与deploy / jboss-web.deployer路径中server.xml中配置的端口不同

<Connector port="8381" address="${jboss.bind.address}"    
         maxThreads="350" maxHttpHeaderSize="8192"
         emptySessionPath="true" protocol="HTTP/1.1"
         enableLookups="false" redirectPort="8543" acceptCount="100"
         connectionTimeout="20000" disableUploadTimeout="true" compression="on" />

    <!-- Define a SSL HTTP/1.1 Connector on port 8643
         This connector uses the JSSE configuration, when using APR, the 
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!---->
    <Connector port="8543" protocol="HTTP/1.1" SSLEnabled="true"
            maxThreads="150" scheme="https" secure="true"
            clientAuth="false" sslProtocol="TLS"
            keystoreFile="${jboss.server.home.dir}/conf/localhost.keystore"
        keystorePass="changeit"
    />    

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" address="${jboss.bind.address}" protocol="AJP/1.3"
         emptySessionPath="true" enableLookups="false" redirectPort="8543" />

      <Engine name="jboss.web" defaultHost="localhost" jvmRoute="data1">

我们将https端口设置为8543,然后该端口工作了,但是当用户访问http URL时,将用户重定向到的https端口为8744(当我们在server.xml中设置8744时,它可以正常工作),但是我们可以找不到8744端口在哪里,有人知道如何配置web.xml中第一个提到的代码重定向到哪个端口

另一个查询是,当我们将此配置投入生产时,https端口将为“ 443”,我们需要知道将“ security-constraint”条目重定向到何处设置443。 然后,访问http://www.data.com必须重定向到https://www.data.com

问候,米林达

好吧,好消息是,它将在生产中运行良好。 安全约束正在发挥作用,但是它被设计为仅在http(80)和https(443)之间工作。

请注意8744-8381 = 363 = 443-80

我正在使用JBoss-4.2.3.GA并观察到相同的行为,不确定是否仍在Wildfly上执行此操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM