Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirecting from non ssl port 8080 to ssl port 8443

I am trying to redirect the traffic on non-SSL port 8080 to SSL port 8443( on Jboss 4.2.3.GA version), but its not working. when I access my webapplication on this port it stays on that port and the page gets displayed. Here is my configuration in server.xml file

<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"/>

and here is web.xml configuration

<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>

I have tried using default port 80 and 443 and also using the specific path in the url-pattern but still its not working. I am not sure what is it i am doing wrong here, can you please point me in the right direction.

thanks.

like image 495
user1172498 Avatar asked Feb 02 '23 07:02

user1172498


1 Answers

edit in 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>

edit in 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"/>

it is working for me ..you can try it

like image 148
user1622168 Avatar answered Feb 11 '23 19:02

user1622168