从非ssl端口8080重定向到ssl端口8443

use*_*498 9 ssl jboss redirect

我试图将非SSL端口8080上的流量重定向到SSL端口8443(在Jboss 4.2.3.GA版本上),但它无法正常工作.当我在这个端口上访问我的webapplication时,它会停留在该端口上并显示页面.这是我在server.xml文件中的配置

<Connector port="8080" address="${jboss.bind.address}"    
     maxThreads="250" maxHttpHeaderSize="8192"
     emptySessionPath="true" protocol="HTTP/1.1"
     enableLookups="false" redirectPort="8443" acceptCount="100"
     connectionTimeout="20000" disableUploadTimeout="true"/>

<!-- Define a SSL HTTP/1.1 Connector on port 8443
     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="8443" protocol="HTTP/1.1" SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS" keystoreFile="conf/sds/keystore"/>
Run Code Online (Sandbox Code Playgroud)

这是web.xml配置

<security-constraint>
  <web-resource-collection>
    <web-resource-name>SUCTR</web-resource-name>
    <url-pattern>/*</url-pattern>      
  </web-resource-collection>
  <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  </user-data-constraint>
</security-constraint>
Run Code Online (Sandbox Code Playgroud)

我尝试使用默认端口80和443,并使用url-pattern中的特定路径,但仍然无法正常工作.我不确定我在这里做错了什么,请你指点我正确的方向.

谢谢.

小智 11

在web.xml中编辑

<security-constraint>
    <web-resource-collection>
        <web-resource-name>App_nmae</web-resource-name>
        <url-pattern>/*</url-pattern>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
    </web-resource-collection>

    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>
Run Code Online (Sandbox Code Playgroud)

在sever.xml中编辑

<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
          maxThreads="150" scheme="https" secure="true"
          clientAuth="false" sslProtocol="TLS" 
          keystoreFile="/opt/apache-tomcat-6.0.13/.keystore"
          keystorePass="changeit"/>
Run Code Online (Sandbox Code Playgroud)

它对我有用..你可以尝试一下


sou*_*ser 0

看起来不错。我假设您正在关闭安全约束标签。尝试将 url 模式更改为“/APP_URI/*”,看看访问应用程序时是否有所不同。