問題点
Laravelのメンテコマンドを実行し、許可するIPを設定してもメンテナンス画面になってしまいます。
開発環境では、メンテモードにしても自分のIPからであれば動かすことはできたのですが、
本番環境ではallowに自分のIPを設定したにもかかわらず、メンテナンス画面になってしまいます。
本番環境環境はALB配下にあるのですが、それが問題なのでしょうか?
それが問題だとした場合、コマンドでのメンテナンスモードでは解決できず、ミドルウェア等を実装して実現するしかないのでしょうか?
やったこと
$ artisan down --allow=xxx.xxx.xxx.xxx
(自分のIP)
環境
AWS
開発環境: EC2
本番環境: ALB配下のEC2
どちらも自分のIPからはアクセス可能です。
〜〜〜
追記
CheckForMaintenanceModeをオーバーライドし、HTTP_X_FORWARDED_FORを読むようにしました。
※本番では未確認
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed * * @throws \Symfony\Component\HttpKernel\Exception\HttpException */ public function handle($request, Closure $next) { if ($this->app->isDownForMaintenance()) { $data = json_decode(file_get_contents($this->app->storagePath().'/framework/down'), true); // ロードバランサー対応 if (isset($data['allowed']) && IpUtils::checkIp($request->server->get('HTTP_X_FORWARDED_FOR'), (array) $data['allowed'])) { return $next($request); } if (isset($data['allowed']) && IpUtils::checkIp($request->ip(), (array) $data['allowed'])) { return $next($request); } if ($this->inExceptArray($request)) { return $next($request); } throw new MaintenanceModeException($data['time'], $data['retry'], $data['message']); } return $next($request); }

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/06/14 10:41
2019/06/14 10:56
2019/06/14 12:03
2019/06/14 12:07
2019/06/14 12:25
2019/06/15 02:47
2019/06/24 05:14
2019/06/24 06:58