Sometimes, we come across below error in Laravel application. There is nothing wrong with your coding, it happens mostly when we have Cloudflare connected.
was loaded over https, but requested an insecure xmlhttprequest endpoint laravel
All we need to do is, change flexible SSL to Full and this will fix the above problem.
Do you use Cloudflare? Change flexible SSL to Full.