jcadima
6/4/2018 - 7:55 PM

Laravel https


https://stackoverflow.com/questions/35827062/how-to-force-laravel-project-to-use-https-for-all-routes

(1)
nginx:
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name example.com www.example.com;
    return 301 https://example.com$request_uri;
}

(2)
env:
APP_URL=https://example.com

(3)
Use helper secure_url() (Laravel5.6)

Add following string to AppServiceProvider::boot() method (for version 5.4+):

\Illuminate\Support\Facades\URL::forceScheme('https');