How to fix Laravel error, insecure xmlhttprequest endpoint

Sometimes, you may come across an error in Laravel application of ‘insecure xmlhttprequest endpoint’. This is not because of something wrong with your coding, it may happen mostly when we are connected to Cloudflare.

The error: ‘loaded over https, but requested an insecure xmlhttprequest endpoint Laravel’

You can simply change flexible SSL to Full as shown below, and this will fix your problem.

Do you use Cloudflare? Change flexible SSL to Full.