Setting up laravel https request / secure http request / setting up ssl settings in laravel

  • Created: 28-06-2019
  • Posted By: Safina

How to force Laravel Project to use HTTPS for all routes?

1. Configure your web server to redirect all non-secure requests to https. Example of a nginx config:
server {

    listen 80 default_server;
    listen [::]:80 default_server;
    return 301$request_uri;

2. Set your environment variable APP_URL using https:

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

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

5.Implicitly setting scheme for route group (Laravel5.6):
Route::group(['scheme' => 'https'], function () {
    // Route::get(...)->name(...);

6. Place this in the AppServiceProvider in the boot() method
if($this->app->environment('production')) {


Post Comments