应用Yaml配置
服务器:
tomcat: remote_ip_header: x-forwarded-for protocol_header: x-forwarded-proto
上面的tomcat标头告诉服务器原始请求是http还是https,
在ResourceServerConfigurerAdapter中的configure(…)方法重写:configure(…)中,我们必须添加以下行
如果(profile.equalsIgnoreCase(Constants.SPRING_PROFILE_PRODUCTION)){http.requiresChannel()。anyRequest()。requiresSecure();
}



