Symfony2 behind ELB is redirecting to http instead of https

后端 未结 7 1437
予麋鹿
予麋鹿 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:48

    The solutions above did not work for me. I added the following line of code (as suggested in Symfony2's docs http://symfony.com/doc/current/cookbook/request/load_balancer_reverse_proxy.html#but-what-if-the-ip-of-my-reverse-proxy-changes-constantly) to my web/app.php:

    Request::setTrustedProxies(array($request->server->get('REMOTE_ADDR')));
    

    right after

    $request = Request::createFromGlobals();
    

    That solved the problem for me in Symfony 2.5.

提交回复
热议问题