title: HTTP to HTTPS Redirects for AWS ELB and Tomcat7 server
body: <p>I have one subdomain(test.XXXX.com) pointed to AWS ELB that accepts HTTP(80) and HTTPS(443) requests. I have configured SSL certificated for for 443 for HTTPS connection.
  I have tried doing HTTP to HTTPS redirects at Tomcat level by changing web.xml and server.xml as mentioned in </p>
  
  <p><a href="http://www.journaldev.com/160/steps-to-configure-ssl-on-tomcat-and-setup-auto-redirect-from-http-to-https" rel="noreferrer">http://www.journaldev.com/160/steps-to-configure-ssl-on-tomcat-and-setup-auto-redirect-from-http-to-https</a></p>
  
  <p>But the problem is that I need one endpoint for AWS ELB health check that does not do the HTTP to HTTPS redirect.
  I have tried different solution but no success.I also tried </p>
  
  <pre><code>   &lt;security-constraint&gt;
                  &lt;web-resource-collection&gt;
                          &lt;web-resource-name&gt;Protected Context&lt;/web-resource-name&gt;
                          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
                  &lt;/web-resource-collection&gt;
  
                  &lt;user-data-constraint&gt;
                          &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;
                  &lt;/user-data-constraint&gt;
      &lt;/security-constraint&gt;
     &lt;security-constraint&gt;
                  &lt;web-resource-collection&gt;
                          &lt;web-resource-name&gt;Protected Context&lt;/web-resource-name&gt;
                          &lt;url-pattern&gt;/XXXXX/XXXXXX.html&lt;/url-pattern&gt;
                  &lt;/web-resource-collection&gt;
  
      &lt;/security-constraint&gt;
  </code></pre>
  
  <p>And my server server.xml has following configuration as </p>
  
  <pre><code>&lt;Connector port="80" protocol="HTTP/1.1"
                 connectionTimeout="20000"
                 redirectPort="443" /&gt;
  
  
  &lt;Connector port="443" maxThreads="2000" scheme="https" secure="true" SSLEnabled="true" keystoreFile="/home/XXXXX/XXXXX.keystore" 
                 keystorePass="XXXXX" clientAuth="false" keyAlias="XXXX" 
                 sslProtocol="TLS" protocol="org.apache.coyote.http11.Http11Protocol"/&gt;
  </code></pre>
  
  <p>But when try to access it through browser it gives exception as ERR_TOO_MANY_REDIRECTS.</p>
  
  <p><a href="https://i.stack.imgur.com/mETR3.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/mETR3.jpg" alt="enter image description here"></a></p>