title: HTTP to HTTPS redirection issue with Tomcat 8
body: <p>I am trying to setup HTTP to HTTPS redirection in Tomcat 8.
  The below is the configuration-
  web.xml</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;security-constraint&gt;
      &lt;web-resource-collection&gt;
      &lt;web-resource-name&gt;securedapp&lt;/web-resource-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/web-resource-collection&gt;
      &lt;auth-constraint /&gt;
      &lt;user-data-constraint&gt;
          &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;
      &lt;/user-data-constraint&gt;
  &lt;/security-constraint&gt;
  </code></pre>
  
  <p>server.xml</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Connector executor="tomcatThreadPool"
             port="50915"
             protocol="org.apache.coyote.http11.Http11NioProtocol"
             maxHttpHeaderSize="99999"
             server=" Web"
             keepAliveTimeout="90000"
             maxKeepAliveRequests="-1"
             acceptorThreadCount="40"
             allowTrace="true"
             redirectPort="50921" /&gt;
  &lt;Connector executor="tomcatThreadPool"
             port="50921"
             protocol="org.apache.coyote.http11.Http11NioProtocol"
             maxHttpHeaderSize="99999"
             SSLEnabled="true"
             maxThreads="150"
             scheme="https"
             secure="true"
             server="Web"
             keepAliveTimeout="90000"
             maxKeepAliveRequests="-1"
             acceptorThreadCount="40"
             allowTrace="true"
             keystoreFile="/web/home/wb10d1/.keystore"
             keystorePass="changeit"/&gt;
  </code></pre>
  
  <p>Update#1
  I am able to access via http and http at the ports configured without any problem:</p>
  
  <pre><code>http://hostname:50915/webapp
  https://hostname:50921/webapp
  </code></pre>
  
  <p>But when I try to access as below 
      <a href="https://hostname:50915/webapp" rel="nofollow noreferrer">https://hostname:50915/webapp</a></p>
  
  <p>I expect that Tomcat should redirect it from non-SSL connector configured for port# 50915 to SSL connector configured for port#50921, but it does not seem to be working. The only error I see is the one below.</p>
  
  <p>catalina.out</p>
  
  <pre><code>[#|INFO|2016-03-05 00:14:55.524+1000|1|org.apache.coyote.AbstractProtocol.start|Starting ProtocolHandler ["http-nio-50915"]|#]
  [#|INFO|2016-03-05 00:14:55.536+1000|1|org.apache.coyote.AbstractProtocol.start|Starting ProtocolHandler ["http-nio-50921"]|#]
  [#|INFO|2016-03-05 00:14:55.541+1000|1|org.apache.catalina.startup.Catalina.start|Server startup in 6831 ms|#]
  [#|INFO|2016-03-05 00:15:33.254+1000|120|org.apache.coyote.http11.AbstractHttp11Processor.process|Error parsing HTTP request header
   Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.|#]
  </code></pre>
  
  <p>I have passed "-Djava.net.debug=all" to java, but that does not give anything more than above error.
  From the above error it is quite clear why the header was not being parsed. Is there a way to get a deeper level of debug output to aid nailing down the issue?</p>
  
  <p>I have seen other similar questions like <a href="https://stackoverflow.com/questions/23805402/http-to-https-redirect-tomcat-jboss">this</a> and <a href="https://stackoverflow.com/questions/4260226/tomcat-issue-with-redirecting-from-http-to-https">this</a> . However, these do not seem to work for me.</p>