2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【laravel】AWSでhttps化したはずなのに一部のページだけhttpになる

Posted at

#今回の騒動
AWSにてhttps化したのに本番環境に以降したら一部のページだけhttp表示となり、かなり困っていたので解消方法を共有します。

#前提
環境はlaravel5.8です。
バージョンによっていろいろ違うみたいなのでそこは注意です。

#解消方法
App\Http\Middleware\TrustProxiesに protected $proxies = '**'; を入れるだけ

##実例

TrustProxies

<?php

namespace App\Http\Middleware;

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

class TrustProxies extends Middleware
{
    /**
     * The trusted proxies for this application.
     *
     * @var array|string
     */
    // protected $proxies;
    // protected $proxies = [
    //     '172.31.36.97/16',
    // ];
    protected $proxies = '**'; //付け加えた
    /**
     * The headers that should be used to detect proxies.
     *
     * @var int
     */
    protected $headers = Request::HEADER_X_FORWARDED_ALL;
}

laravel公式マニュアルを参照しました。
https://readouble.com/laravel/5.5/ja/requests.html#configuring-trusted-proxies

2
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?