Fermin Perdomo
Full Stack Developer
© 2024 Fermin's Portfolio | All rights reserved.
How to fix Mixed Content: https error on laravel apps
I moved my website to HTTPS and now I am receiving an error message in the Statamic control panel (CP).:
Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint '<URL>'. This request has been blocked; the content must be served over HTTPS.
I am using Statamic Laravel app. To fix this issue, you need to go to the AppServiceProvider
file and force the scheme to be HTTPS:
use Illuminate\Support\Facades\URL;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(): void
{
if($this->app->environment('production')) {
URL::forceScheme('https');
}
}
}