【发布时间】:2022-01-22 17:51:16
【问题描述】:
我的 Spring-boot 应用程序位于 Apache 代理后面。
我的应用程序正在处理http,与 SSL 相关的任务由代理服务器处理。
我正在使用 Spring-security 的登录页面。 以下是我的安全配置:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.cors();
http.authorizeRequests()
.antMatchers("/admin/**").hasAuthority("Admin")
.anyRequest().permitAll()
.and()
.formLogin()
.defaultSuccessUrl("/admin", true);
}
因此,作为具有管理员权限的人成功登录,我重定向到 /admin。 在我使用 apache 代理之前,这一切正常。
在使用代理之前它工作正常。
( http://myhost/login >> 成功登录后重定向到 >> http://myhost/admin )
使用代理后:
( https://myhost/login >> 成功登录后重定向到 >> http://myhost/admin )
主要问题是它重定向到http 而不是https。
下面是我的 apache 代理配置:
ProxyPreserveHost on
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
我的问题是如何在登录后重定向到https。
任何帮助将不胜感激!!!
【问题讨论】:
标签: java spring-boot apache spring-security reverse-proxy