Using HTTPS on your site
Learn how to use https on your site
Symptom:
When visiting your site with HTTPS, images within admin panel fail to load.
Cause:
Images urls are generated by admin panel using
Storage::disk(config('admin.storage.disk'))->url($file);
If voyager.storage.disk is set to public, and the public disk is the default from Laravel, then the url property in the disk configuration is set to
'url' => env('APP_URL').'/storage',
which uses the non-HTTPS APP_URL value to build an absolute url to the image.
Solution:
If you remove env('APP_URL'). from the public disk configuration, then it will render a domain-relative url, which will always use the current domain and protocol.
As an aside, if you need a fully-qualified URL, you could wrap the call to Admin::image('...')
with asset()
, so it would be
asset(Admin::image('...'))
This will return the current protocol, domain, and correct path to that image.
Updated less than a minute ago