Laravel-filemanager: This request has been blocked; the content must be served over HTTPS.

Created on 28 Oct 2017  路  6Comments  路  Source: UniSharp/laravel-filemanager

I got some problem when I deploy my project in HTTPS server.

screen shot 2017-10-28 at 11 33 16 am

bug enhancement

Most helpful comment

@weeework @youchenlee @streamtw
It is not the bug of Laravel file manager. So it is laravel bug.

The helper url() cannot return with https.

For more details, open /vendor/laravel-filemanager/index.blade.php

the 156 and 157 th line uses
var route_prefix = "{{ url('/') }}"; `` var lfm_route = "{{ url(config('lfm.url_prefix', config('lfm.prefix'))) }}";

Fix method:
Open AppServiceProvider and add that code.

class AppServiceProvider extends ServiceProvider
{
 public function boot()
 {
    \URL::forceRootUrl(\Config::get('app.url'));    
    if (str_contains(\Config::get('app.url'), 'https://')) {
        \URL::forceScheme('https');
    }
 }

All 6 comments

I have some issue like this. ssl/https successfully work on laravel project.

error message in jquery.js, url https://uxxxx.com/laravel-filemanager?type=image

because route_prefix and lfm_route still loaded in http

I edit on vendor/unisharp/laravel-filemanager/public/js/script.js

chenge manualy
lfm_route

to your url ex
https://mywebsite.com

Thank you @weeework and @habibix

Yes, this should be configurable or auto-detected. Will schedule this to our next release.

I think this is fixed in v2.0.0 alpha versions.

@weeework @youchenlee @streamtw
It is not the bug of Laravel file manager. So it is laravel bug.

The helper url() cannot return with https.

For more details, open /vendor/laravel-filemanager/index.blade.php

the 156 and 157 th line uses
var route_prefix = "{{ url('/') }}"; `` var lfm_route = "{{ url(config('lfm.url_prefix', config('lfm.prefix'))) }}";

Fix method:
Open AppServiceProvider and add that code.

class AppServiceProvider extends ServiceProvider
{
 public function boot()
 {
    \URL::forceRootUrl(\Config::get('app.url'));    
    if (str_contains(\Config::get('app.url'), 'https://')) {
        \URL::forceScheme('https');
    }
 }

Thank you @turanzamanli !

Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fahadhowlader picture fahadhowlader  路  5Comments

anasmorahhib picture anasmorahhib  路  5Comments

asimshazad picture asimshazad  路  4Comments

t67132 picture t67132  路  3Comments

intergalactisch picture intergalactisch  路  5Comments