HTTPS login with Spring Security redirects to HTTP

后端 未结 9 1956
梦如初夏
梦如初夏 2021-01-31 02:12

I have a Spring web app, secured with Spring Security, running on EC2. In front of the EC2 instance is an Elastic Load Balancer with an SSL cert (https terminates at the load ba

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-31 02:46

    If it is a Spring Boot application (I use currently the 2.0.0 release), the following configuration within the application.properties file should be enough:

    server.tomcat.protocol-header=x-forwarded-proto
    

    This worked for me on AWS with an load balancer at the front.

    For Spring Boot < 2.0.0 it should also work (not tested)

提交回复
热议问题