Skip to content

Instantly share code, notes, and snippets.

@Justintime50
Created February 16, 2022 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Justintime50/049e780a5428f8394ef283b0442fbe90 to your computer and use it in GitHub Desktop.
Save Justintime50/049e780a5428f8394ef283b0442fbe90 to your computer and use it in GitHub Desktop.
Fix the insecure mixed content error in a Laravel production instance.

Insecure or Mixed Content Production Laravel

Make sure your AppServiceProvider.php file has a boot function that looks like this to avoid the was not allowed to run insecure content error in production:

use Illuminate\Support\Facades\URL;

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    if (config('app.env') === 'production') {
        URL::forceScheme('https');
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment