Ssl – ELB Https with HTTP on backend using Tomcat without nginx or haproxy

amazon-elbload balancingssltomcat

I want to setup ELB to terminate SSL at load balancer and communicate with backend instances over HTTP. I have uploaded valid certificate on ELB. When I set up following configuration

ELB – HTTPS

Backend – HTTP

Then if application performs redirect in application, client/browser is redirected to HTTP instead of HTTPS.

Although, if I set ELB to use HTTPS and backend instances also on HTTPS(even using self signed certificate) everything works fine as both the configurations are on HTTPS!

I am using Tomcat on backend instances and do not want to use any other layer in between(e.g. nginx or haproxy)

Best Answer

I found this article which seems pretty similar to your problem: http://willwarren.com/2014/01/27/running-apache-tomcat-with-ssl-behind-amazon-elb/

Basically states on changing server.xml to this:

<Connector
    port="8080"
    protocol="HTTP/1.1"
    proxyPort="443"
    scheme="https"
    secure="true"
    proxyName="myapp.example.com"
    connectionTimeout="20000"
    URIEncoding="UTF-8"
    redirectPort="8443" />