2017-08-24 53 views
0

我非常新的SSL/HTTPS,但最終成功地創造一個爲我的網站鏈接請求了一個不安全的XMLHttpRequest端點

https://thaihome.co.uk

現在的問題是這個奇怪的錯誤:

app.7e27c5b6c47cfaa5a0da.js:70 error occured for getting the country from: http://freegeoip.net/json/ {data: null, status: -1, config: {…}, statusText: "", headers: ƒ} 
app.7e27c5b6c47cfaa5a0da.js:70 Mixed Content: The page at 'https://thaihome.co.uk/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://freegeoip.net/json/'. This request has been blocked; the content must be served over HTTPS. 

它的吐出速度太快,導致瀏覽器幾乎死亡。

這是什麼意思?我能做些什麼來解決它?

enter image description here

回答

3

錯誤消息很清楚地解釋了它,並告訴你到底需要做什麼來修復它。

Mixed Content

您正在混合內容(來自HTTPS和HTTP)。

The page at ' https://thaihome.co.uk/ '

這是您的頁面。

was loaded over HTTPS

你說你設置爲HTTPS。現在是HTTPS。

but requested an insecure XMLHttpRequest endpoint ' http://freegeoip.net/json/ '.

而你有一些使用XMLHttpRequest對象發出HTTP請求的JavaScript。

您請求的URL是http://freegeoip.net/json/這是不安全的。即它使用HTTP而不是HTTPS。你可以告訴,因爲它開始http:

This request has been blocked;

因爲它是不安全的,它已被阻止。否則,它會將不安全的內容注入到其他安全的頁面中。該頁面將不再安全。

the content must be served over HTTPS.

您需要通過HTTPS加載它,因此在從HTTPS頁面加載它之前它是安全的。

+0

謝謝你一個很好的解釋! – torbenrudgaard

2

這意味着你需要做的API請求的https://freegeoip.net/json代替http://freegeoip.net/json

編輯:當您在您的網站啓用SSL,所有資產,並要求必須由端點保護。即使你有一個圖像標籤,有一個不安全的圖像鏈接去http這樣:<img src="http://unsecure.com/img.jpeg" />你的瀏覽器不會給你的綠色鎖安全符號。一切都需要通過https完成。

+0

太好了,謝謝約書亞! – torbenrudgaard