Jason FB
Jason FB

Reputation: 5930

fetch is told to call an http resource, but it calls an https one instead

here's my code inside of a React app

I am using the JS native fetch

  fetch('http://signup.momeas.com/index.php&user=' +  email +  '&timezone=' + tz , {
      mode: 'no-cors',
      method: 'POST',
      body: JSON.stringify({
        _method: 'POST',
        email: email,
        timezone: tz
      })

when the cal happens, the URL requested is https, not http

fetch

no matter what I do the call that goes out to the external server (at signup.momeas.com) always goes to https

Upvotes: 3

Views: 4243

Answers (1)

P.B.UDAY
P.B.UDAY

Reputation: 483

I looked into the docs and as far as I can tell it should work when you specify unsafe_url option

fetch('https://another.com/page', {
// ...
referrerPolicy: "unsafe-url" 
});

Try to see if that works.

see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy

Docs : https://javascript.info/fetch-api

Upvotes: 2

Related Questions