2

I have a laravel 7 app running in a dokku container that is secured with letsencrypt. My RESTful/graph endpoints are correctly served securely but my admin backend is trying to load insecure assets over http.

I've set the following environment variables:

I've also tried to enforce https through routes/web.php:

if (App::environment('production')) {
    URL::forceScheme('https');
}/

No matter what, laravel backpack is loading assets through http://example.com/... thus leading to a mixed-content error.

waffl
  • 5,179
  • 10
  • 73
  • 123

1 Answers1

1

Please use secure_asset('...')

BTW, URL::forceScheme('https'); also works, may be you have other mistake in provider.

Omer YILMAZ
  • 1,234
  • 1
  • 7
  • 15
  • the thing is, the AJAX calls backpack makes are also to http:// (eg, http://example.com/admin/post/search) – waffl May 06 '20 at 12:39
  • 1
    Please double check current protocol in browser. And double check your URL::forceScheme('https'); is running this code should be in AppServiceProvider.php – Omer YILMAZ May 06 '20 at 12:52
  • 2
    Ok! Adding `Url::forceScheme('https')` to `AppServiceProvider.php` did the trick, thank you :) – waffl May 06 '20 at 22:38