首页 > 解决方案 > some laravel route not changing to https

问题描述

There are some my route not going to HTTPS in my Javascript code

loadSettingTable("{{ route('setting.table.data.datatable') }}");

they become like this, so my datatable can't be load because mixed content.

loadSettingTable("http://*****.com/admin/data-setting-table/datatable");

but my css and JS file already become HTTPS. I already give this on my AppServiceProvider and ENV

//AppServiceProvider.php on Boot
if(env('REDIRECT_HTTPS')) {
    $url->formatScheme('https');
    URL::forceScheme('https');
}
//.ENV
REDIRECT_HTTPS=true

But some of it work fine with this code, why my code with route name not giving https?

loadTableRealCommSumAgent("/agent/commissions-summary-member-ajax");

标签: laravelhttpsroutes

解决方案


我自己发现了这个错误,但真的不知道为什么这个错误发生在我的生产服务器而不是登台服务器上。我删除 $url->formatScheme('https'); 因为它在生产上给出了一些错误,但并非总是如此,它解决了我的问题。


推荐阅读