I deployed my website and it contains an API that will not work and in console, it shows some error but the site will work properly in my localhost.
error: Mixed Content: The page at 'index.html' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ---"URL". This request has been blocked; the content must be served over HTTPS.
CodePudding user response:
This means that you accessed your website using HTTPS
, but when you XMLHttpRequest
, you're using HTTP
in that code. It would be helpful to see that code. If you're using XMLHttpRequest
like this: http://example.com/
, change it to: https://example.com/
. This error means you need to use all HTTPS
or all HTTP
.
Edit: According to another StackOverflow post, you should actually leave out the http
/https
completely:
//example.com/