Did some more research and found a solution. The specifics of my situation are:
- Requests come into an AWS load balancer (ALB)
- SSL is terminated at the ALB and only http traffic is sent to the EC2 server
- ALB does not accept any outside http traffic (only https)
- tomcat wants to redirect to http because that is what it sees
- added properties (below) to tell tomcat to pay attention to the
x-forwarded-proto
header
- Success - now tomcat redirects to the https version of the URLs
Found solution at Spring documentation: Enable HTTPS When Running Behind a Proxy Server
Added these 2 lines to my application.properties
file:
server.tomcat.remoteip.remote-ip-header=x-forwarded-for
server.tomcat.remoteip.protocol-header=x-forwarded-proto