简体   繁体   English

从 https 网站获取对 http 地址的请求

[英]Fetch request to http address from a https website

Is it some how possible to send a get request from a https website to a http address with fetch api.是否有可能使用 fetch api 从 https 网站向 http 地址发送 get 请求。

fetch('http://103.82.8.194/Data/', { mode: 'no-cors' })
    .then(response => response.json())
    .then(data =>
        console.log(data)
    );

Like is it some how possible send this request from https://rionislam.github.io ?就像从https://rionislam.github.io发送这个请求有可能吗?

Thanks...谢谢...

It's not possible to request http address from a https website directly because of the Mixed Content Security Policy , it'll be blocked by the browser.由于混合内容安全策略,无法直接从 https 网站请求 http 地址,它会被浏览器阻止。

You can use a https proxy to do so, something like: https://some-proxy-url?url=http://103.82.8.194/Data/.您可以使用 https 代理来执行此操作,例如:https://some-proxy-url?url=http://103.82.8.194/Data/。

or just upgrade http server to https或者只是将 http 服务器升级到 https

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM