admin管理员组

文章数量:1398828

Is it some how possible to send a get request from a https website to a http address with fetch API.

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 ?

Is it some how possible to send a get request from a https website to a http address with fetch API.

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 ?

Share Improve this question edited Jul 11, 2023 at 18:37 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked May 27, 2022 at 7:34 Rion IslamRion Islam 741 gold badge2 silver badges6 bronze badges 1
  • Why do you want it? It is not possible with javascript alone in a browser that others usually use. It seems that you need to create a proxy server that receives http requests. It is best to include the data on your website instead of requesting it. – lowfront Commented May 27, 2022 at 8:48
Add a ment  | 

1 Answer 1

Reset to default 4

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.

You can use a https proxy to do so, something like: https://some-proxy-url?url=http://103.82.8.194/Data/.

or just upgrade http server to https

本文标签: javascriptFetch request to http address from a https websiteStack Overflow