spring-projects / spring-projects/spring-security
logout url not responding with https
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Summary
I've got my spring boot container behind Amazon cloudfront with the following settings
server.tomcat.remote_ip_header=x-forwarded-for
server.tomcat.protocol_header=x-forwarded-proto
it has worked well for everything so (including some returned Hateoas links) except now for logout. I set the logout url to / it's returning the right domain, but not https.
`
Actual Behavior
post to logout, via proxy via https://domain.tld returns a 302 http://domain.tld/
Expected Behavior
post to logout, via proxy via https://domain.tld should return a 302 https://domain.tld/
Configuration
@EnableWebSecurity
class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure( final WebSecurity web ) throws Exception {
web.ignoring()
.antMatchers( "/", "/index.html", "/partials/**/*.html" )
.antMatchers( "/webjars/**/*.js" )
.antMatchers( "/webjars/**/*.css" );
}
@Override
protected void configure( final HttpSecurity http ) throws Exception {
http.authorizeRequests().anyRequest().authenticated()
.and().httpBasic()
.and().logout().logoutSuccessUrl( "/" )
.and().csrf().disable();
}
}
Version
4.0.x
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the WebSecurityConfig example, especially HttpSecurity logoutSuccessUrl, and reproduce the 302 through CloudFront using the shown x-forwarded-for and x-forwarded-proto settings. Trace how the logout success redirect is constructed and verify that posting to logout through HTTPS returns https://domain.tld/ rather than an HTTP URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- authentication, backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100