682 0 0 0
Last Updated : 2025-04-28 22:20:39
In this snippet I will explain how to force all URLs in your website to follow HTTPS protocol not HTTP
Sometimes when deploying your website to live server, AJAX calls may have a conflict with HTTP protocols because all website URLs follow HTTPS protocol and other URLs in your website still follow HTTP protocol.
To Solve this, you have to force all website URLs to Follow HTTPS protocols in AppServiceProvider file use this code
use Illuminate\Support\Facades\URL;
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if(env('APP_ENV') != 'local') {
URL::forceScheme('https');
}
}