1
  1. I have backend panel in laravel 8 for example

https://fakeurl.org/admin

  1. When I enter id and password in the login then dashboard url becomes http instead of https and the error message says

The information that you’re about to submit is not secure

What I have done.

  1. APP_ENV is in production and APP_DEBUG is false
  2. I wrote the below coding in config App.php
if (env (key: ‘APP_ENV’) !== ‘local’) {
    URL::forceScheme( scheme: ‘https’);
}
  1. asset_url is https in the app.php

I hope someone faced this issue. I have been trying for last 4 days.

Thanks!

enter image description here

  • Are you really using `‘` and `’` quotes. Using non ascii standard single quotes can cause odd issues – RiggsFolly May 05 '22 at 15:42
  • actually I did. Please see the screenshot. :( thanks for your suggestion to check the quote again. –  May 05 '22 at 17:34

1 Answers1

0

You will want to do this as middleware which is my suggestion: Laravel 5 - redirect to HTTPS which gives you more flexibility as you can apply it to all routes or some depending on your use case.

Or you can add it to the AppServiceProvider in the boot() method:

if($this->app->environment('production')) {
    URL::forceScheme('https');
}
josezenem
  • 300
  • 1
  • 5
  • I have tried this too, this is how it happens, 1.hit enter to login, the url changes. 2. without https, dashboard page comes. 3). if i change dashboard url into https then dashboard with https opens. 4) problem with login wayout. Any gueses please –  May 06 '22 at 04:05