1
1

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でlocal以外は強制的にhttpsを利用する

Last updated at Posted at 2020-08-31

Heroku(無料版)でhttpsスキームを利用したかったので、
LaravelのAppServiceProvider.phpに分岐を追加しました。
前提として、ローカルの開発環境.envにAPP_ENV=localを設定しています。

app/Providers/AppServiceProvider.php
24     public function boot()
25     {
26         // use https on Heroku
27         if (!\App::environment('local')) {
28             \URL::forceScheme('https');
29         }
30     }
1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?