Symfony2 behind ELB is redirecting to http instead of https

后端 未结 7 1346
予麋鹿
予麋鹿 2021-02-01 17:04

Issue:

  • User logs in with https://example.com/login
  • Authentication is approved
  • As configured in security.yml Symfony2 redirects u
7条回答
  •  北海茫月
    2021-02-01 17:45

    How to force Symfony to generate redirect URL with https protocol instead http?

    You need to explicitly configure the HTTPS protocol because by detection alone, Symfony2 will only guess HTTP as HTTP is used as transport protocol to the application.

    So for the component that creates the redirect URI, you need to inject the HTTPS base URI-Scheme. One simple way to do this, is to configure the base-URI as a parameter and then within the configuration.

    Example codes are given

    • like: http://web.archive.org/web/20130119123312/http://www.dobervich.com/2011/05/19/more-sophisticated-symfony2-login-redirection/
    • or: http://web.archive.org/web/20130119124912/http://www.dobervich.com/2011/10/13/login-redirection-revisited/

提交回复
热议问题