amazon web services - Spring Boot with Embedded Tomcat behind AWS ELB - HTTPS redirect -


running spring boot application port 8080 on ec2 instance.

aws elb configured redirect

     80 -> 8080      443 (ssl termination happens here) -> 8080 

application uses spring security , if user arrives http://example.com redirect . login page use ssl.

spring security snippet:

 http.requireschannel().antmatchers("/login", "/logout").requiressecure(); 

we running redirect loop makes sense.

to spring boot application looks requests made non-secured port 8080, redirects https://example.com, goes through elb , again gets request on 8080

any ideas on how run aws elb ???

looks did trick:

@component public class tomcatcustomizer implements embeddedservletcontainercustomizer {  @override public void customize(configurableembeddedservletcontainer container) {     tomcatembeddedservletcontainerfactory tomcat = (tomcatembeddedservletcontainerfactory) container;     tomcat.addconnectorcustomizers(new tomcatconnectorcustomizer() {         @override         public void customize(connector connector) {             connector.setsecure(true);           }     });  } 

}


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -