I have my Spring-boot app behind Apache proxy.
My app is working on http
and SSL related tasks are handled by proxy server.
I'm using Spring-security's login page. Below is my security configurations:
@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);
}
So as a person with Admin authority login successfully I redirect to /admin. This was working fine until I used apache proxy.
Before using proxy it was working fine.
( http://myhost/login >> after successful login redirects To >> http://myhost/admin )
After using proxy:
( https://myhost/login >> after successful login redirects To >> http://myhost/admin )
The main issue is that it redirecting to http
instead of https
.
Below is my apache proxy config:
ProxyPreserveHost on
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
My question is how can I redirect to https
after login.
Any help would be appreciated !!!