Unable to get http redirect to https on Apache Tomcat 8.5.57

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to get http redirect to https on Apache Tomcat 8.5.57

Lee Jarvis
Hi all,
 
I’m trying to implement SSL and have defined a connector on ports 8080 and 8443. I can connect to either port, but I want any incoming HTTP on 8080 to be redirected to the HTTPS port on 8443, but that’s not happening as I have things configured below. What
am I missing?
 
<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
    connectionTimeout="60000"
    redirectPort="8443"
    relaxedQueryChars='^{}[]|&quot;' />
 
 
<Connector
    protocol="org.apache.coyote.http11.Http11NioProtocol"
    connectionTimeout="60000"
    port="8443"
    maxThreads="200"
    scheme="https"
    secure="true"
    SSLEnabled="true"
    keystoreFile="///C:/apache-tomcat-8.5.57/webapps/cmms/WEB-INF/classes/keystore.jks"
    keystorePass="********"
    clientAuth="false"
    sslProtocol="TLSv1.2"
    relaxedQueryChars='^{}[]|&quot;' />
 
Thanks & regards,Lee Jarvis
Reply | Threaded
Open this post in threaded view
|

Re: Unable to get http redirect to https on Apache Tomcat 8.5.57

markt
On 14/09/2020 20:22, Lee Jarvis wrote:

> Hi all,
>  
> I’m trying to implement SSL and have defined a connector on ports 8080 and 8443. I can connect to either port, but I want any incoming HTTP on 8080 to be redirected to the HTTPS port on 8443, but that’s not happening as I have things configured below. What
> am I missing?
>  
> <Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
>     connectionTimeout="60000"
>     redirectPort="8443"
>     relaxedQueryChars='^{}[]|&quot;' />
>  
>  
> <Connector
>     protocol="org.apache.coyote.http11.Http11NioProtocol"
>     connectionTimeout="60000"
>     port="8443"
>     maxThreads="200"
>     scheme="https"
>     secure="true"
>     SSLEnabled="true"
>     keystoreFile="///C:/apache-tomcat-8.5.57/webapps/cmms/WEB-INF/classes/keystore.jks"
>     keystorePass="********"
>     clientAuth="false"
>     sslProtocol="TLSv1.2"
>     relaxedQueryChars='^{}[]|&quot;' />
>  
> Thanks & regards,Lee Jarvis

In the configuration above, there is nothing to configure a redirect
from http to https. You'd normally do this with a transport guarantee in
web.xml (other solutions are available).

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Unable to get http redirect to https on Apache Tomcat 8.5.57

Lee Jarvis


-------- Original message --------From: Mark Thomas <[hidden email]> Date: 9/14/20  3:30 PM  (GMT-05:00) To: [hidden email] Subject: Re: Unable to get http redirect to https on Apache Tomcat 8.5.57 On 14/09/2020 20:22, Lee Jarvis wrote:> Hi all,>  > I’m trying to implement SSL and have defined a connector on ports 8080 and 8443. I can connect to either port, but I want any incoming HTTP on 8080 to be redirected to the HTTPS port on 8443, but that’s not happening as I have things configured below. What> am I missing?>  > <Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol">     connectionTimeout="60000">     redirectPort="8443">     relaxedQueryChars='^{}[]|&quot;' />>  >  > <Connector>     protocol="org.apache.coyote.http11.Http11NioProtocol">     connectionTimeout="60000">     port="8443">     maxThreads="200">     scheme="https">     secure="true">     SSLEnabled="true">     keystoreFile="///C:/apache-tomcat-8.5.57/webapps/cmms/WEB-INF/classes/keystore.jks">     keystorePass="********">     clientAuth="false">     sslProtocol="TLSv1.2">     relaxedQueryChars='^{}[]|&quot;' />>  > Thanks & regards,Lee JarvisIn the configuration above, there is nothing to configure a redirectfrom http to https. You'd normally do this with a transport guarantee inweb.xml (other solutions are available).Mark‐-----------------------------------------Thanks Mark!I added transport guarantee to the web.xml and now I'm seeing the expected redirect behavior, but another problem has popped up.When the redirect occurs to https, my web application just hangs - and I find a "javax.net.ssl.SSLException: Received fatal alert: unexpected_message"Prior to adding the transport guarantee, I was able to access the web app via http or https and all worked fine, but once the redirect took effect - nothing.Thanks for your patient help!Lee J.