0
0

More than 1 year has passed since last update.

【AWS】ACMでLaravelアプリをSSL化したが、フォーム送信でセキュリティ保護されていないメッセージがでるときの対処法

Last updated at Posted at 2021-09-10

個人アプリの作成で、ALBを使用しACMで証明書を取得。
https化までできたところでフォームを送信すると、、、
スクリーンショット 2021-09-10 125515.png

このようなエラーが。。。:sweat:

httpで通信が行われるようになっていたため、
ALBのリスナーの設定がまずいのかといじってみたが改善せず。

#対処法

Laravel側でAWSのロードバランサ用のプロキシ設定が必要でした。

App\Http\Middleware\TrustProxies
<?php

namespace App\Http\Middleware;

use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;


class TrustProxies extends Middleware
{
    /**
     * このアプリケーションで信頼できるプロキシ
     *
     * @var string|array
     */
    protected $proxies = '*'

    /**
     * プロキシを検出するために使用すべきヘッダ
     *
     * @var int
     */
    protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB;
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0