在我的網頁我已經集成了一個攝像頭foscam。它像一個魅力,直到我把我的域名從http切換到https。這個問題似乎是,你不允許與非HTTPS站點進行通信(foscam只能通過HTTP進行通信)從HTTPS站點。這似乎讓完美的,如果你從安全的角度考慮一下它的意義,但我想知道是否有辦法解決它
爲了集成網絡攝像頭,我使用這個腳本:
<script language="JavaScript" type="text/javascript">
function reload()
{
setTimeout('reloadImg("refresh")',10)
};
function reloadImg(id)
{
var obj = document.getElementById(id);
var date = new Date();
obj.src = "http://www.somedomain.com/snapshot.cgi?user=username&pwd=mypw&t=" + Math.floor(date.getTime()/10);
}
@endif
</script>
和
<img src="http://www.somedomain.com/snapshot.cgi?user=username&pwd=mypw&t" name="refresh" id="refresh" onload='reload(this)' onerror='reload(this)'>
還是能夠工作(雖然控制檯確實顯示像錯誤
混合內容:在「https://www.somedomain.nl/webcam」加載頁面通過HTTPS,但請求一個不安全的圖像'http://www.somedomain.nl/snapshot.cgi?user=user&pwd=pass!&t=145244729934'。此內容也應通過HTTPS提供。
,我有真正的問題是用按鈕來控制網絡攝像頭。 對於我使用如下代碼:
$("#left").click(function(){
$.get("http://www.somedomain.nl/decoder_control.cgi?command=6&user=username&pwd=pass&onestep=1",
function(data) {});
});
這些按鈕不工作了,並生成在控制檯中出現以下錯誤:
混合內容:在「https://www.somedomain.nl/webcam」加載頁面通過HTTPS,但要求一個不安全的XMLHttpRequest端點「http://www.somedomain.nl/decoder_control.cgi?command=2&user=someuser&pwd=pass!&onestep=1」。 此請求已被阻止;內容必須通過HTTPS.send @ jquery.js提供:8625jQuery.extend.ajax @ jquery.js:8161jQuery。(匿名函數)@ jquery.js:8306(匿名函數)@ webcam:38jQuery.event.dispatch @ jquery .js:4430elemData.handle @ jquery.js:4116
有沒有辦法解決這個問題?
這裏有一個相關的問題(http://security.stackexchange.com/questions/56779/securing-remotely-accessible-ip-cameras-that-do-not-support-https),解釋瞭如何通過https公開相機。它涉及到,但如果你通過實際的互聯網連接,這可能是值得的。 –
感謝您的建議。通過https使用反向代理進行通信確實是正確的選擇。 – ErikL