after using cloudflares ssl I can’t send a fetch request with https protocol. here is my code:
async function testRun() {
console.log('testRun')
const url = `https://www.google.com/recaptcha/api/siteverify?secret=some_secret_here&response=some_token_here`
const httpsAgent = new https.Agent({
rejectUnauthorized: false,
});
fetch(url, {
method: 'post',
agent: httpsAgent
})
.then(response => {
console.log('response', response)
})
.then(google_response => {
console.log('google_response', google_response)
})
.catch(error => console.log(error));
}
I get this error:
testRun
response Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
url: 'https://www.google.com/recaptcha/api/siteverify?secret=some_secret_here&response=some_token_here',
status: 404,
statusText: 'Not Found',
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
}
google_response undefined
This is working with localhost and I think it may e a SSL or cors issue !