How to disable HTTPS on tomcat and have it run on port 8080?

3.1k Views Asked by At

I have the following connectors in my server.xml. My app runs on port 8080 and I no longer would like it to run on port 8443. How can I modify the connector to disabl HTTPS and only have tomcat run on 8080? Thank you

    <!--
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation that requires the JSSE
         style configuration. When using the APR/native implementation, the
         OpenSSL style configuration is required as described in the APR/native
         documentation -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->
    <Connector port="8443" protocol="HTTP/1.1"
               SSLEnabled="true" maxThreads="150" scheme="https" secure="true"
               keystoreFile="tomcat.keystore" keystorePass="changeit" sslEnabledProtocols="TLSv1.1,TLSv1.2"
               ciphers="TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256"/>
3

There are 3 best solutions below

0
On
This will work

  
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation that requires the JSSE
         style configuration. When using the APR/native implementation, the
         OpenSSL style configuration is required as described in the APR/native
         documentation -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->
<!--
    <Connector port="8443" protocol="HTTP/1.1"
               SSLEnabled="true" maxThreads="150" scheme="https" secure="true"
               keystoreFile="tomcat.keystore" keystorePass="changeit" sslEnabledProtocols="TLSv1.1,TLSv1.2"
               ciphers="TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256"/>
-->
4
On

You need a single Connector:

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

and comment out your port 8443 Connector.

This will listen on the shutdown port (defined in your Server stanza, defaults to 8005) and port 8080 only. Note, however, that if the client code wants to upgrade to HTTPS it will fail as you no longer have the redirectPort.

0
On

As seen from your original code, please uncomment the port="8080" section and comment out the port="8443" section as follows,

Please note that the meaning for redirectPort="8443" is explained in details here

enter image description here