Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force HTTPS redirect on heroku #157

Closed
commjoen opened this issue Jan 14, 2022 · 6 comments
Closed

Force HTTPS redirect on heroku #157

commjoen opened this issue Jan 14, 2022 · 6 comments
Assignees

Comments

@commjoen
Copy link
Collaborator

During our webinar with GitGuardian, we demoed the app , by mistake using http at heroku, which led to an issue with the cookies, not keeping our progress.

Therefore we need to make sure that at Heroku we keep redirecting http traffic to https, with for instance, https://devcenter.heroku.com/articles/preparing-a-spring-boot-app-for-production-on-heroku#force-the-use-of-https

@commjoen
Copy link
Collaborator Author

solution: make sure there is a configuration parameter for thespring boot app on whether redirectohttps is set, and make sure this is then activated in the Dockerfile.web .

@nbaars
Copy link
Collaborator

nbaars commented Jan 15, 2022

Can't you use the the proposed example from Heroku? Seems a valid configuration and does not interfere with running it locally:

@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http.requiresChannel()
      .requestMatchers(r -> r.getHeader("X-Forwarded-Proto") != null)
      .requiresSecure();
  }
}

@commjoen
Copy link
Collaborator Author

Yes that is the one I meant with https://devcenter.heroku.com/articles/preparing-a-spring-boot-app-for-production-on-heroku#force-the-use-of-https but I thought it would cause some interference on some of our deployment variants

@commjoen commjoen self-assigned this Feb 1, 2022
@commjoen
Copy link
Collaborator Author

commjoen commented Feb 1, 2022

hmm it seems i need to have another version of spring security for this.. let me check

@commjoen
Copy link
Collaborator Author

commjoen commented Feb 1, 2022

@nbaars this solution will put on spring cloud security with auth :(

@commjoen
Copy link
Collaborator Author

commjoen commented Feb 1, 2022

Fixed with #173

@commjoen commjoen closed this as completed Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants