aws elb 환경에서 Laravel https 적용 > IT 기술백서

IT 기술백서

직접 알아내거나 검색하기 귀찮아서 모아 둔 것

php | aws elb 환경에서 Laravel https 적용

본문

elb 에서 443 -> 80으로 연결했다면 라라벨은 내부적으로 80으로 요청되기 때문에 redirect() 함수등을 사용할때 http 로 변경된다.

이럴때는 app/Http/Controllers/Middleware/TrustProxies.php 를 수정해주면 된다.

 

[code]

class TrustProxies extends Middleware

{

    /**

     * The trusted proxies for this application.

     *

     * @var array

     */

    protected $proxies;


    /**

     * The headers that should be used to detect proxies.

     *

     * @var string

     */

    protected $headers = Request::HEADER_X_FORWARDED_ALL;

}

[/code]

기본적으로 위와 같이 되어 있다.

이것을 아래와 같이 바꿔준다.

 

[code]

class TrustProxies extends Middleware

{

    /**

     * The trusted proxies for this application.

     *

     * @var array

     */

    protected $proxies = '*';


    /**

     * The headers that should be used to detect proxies.

     *

     * @var string

     */

    protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB;

}

[/code]

댓글 0개

등록된 댓글이 없습니다.

Menu