4

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 ?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Rion Islam
  • 41
  • 1
  • 3
  • 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 May 27 '22 at 08:48

1 Answers1

3

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

Taurz
  • 388
  • 2
  • 6