Hi
i’m doing request with fetch to HTTPS server, which has selfsigned certificate:
fetch('https://198.206.134.30/test_post', {
method: 'POST',
headers: {
"Authorization": "Basic dGVzdHVzZXI6dGVzdHBhc3M=",
"content-type": "application/x-www-form-urlencoded"
},
body: "username=q&passwd=q"
}).then(function(response) {
return response.json();
}).then(function(responseObject) {
console.log('responseObject);
}).catch(function (err) {
console.log("err: " + err);
});
fetch('https://198.206.134.30/test_get', {
method: 'GET',
headers: {
"Authorization": "Basic dGVzdHVzZXI6dGVzdHBhc3M="
}
}).then(function(response) {
return response.json();
}).then(function(responseObject) {
console.log('responseObject);
}).catch(function (err) {
console.log("err: " + err);
});
Always i get error: TypeError: Network request failed
** It works correctly over curl: **
req: curl -X GET -H "Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=" "https://198.206.134.30/test_get" -k
res: TEST SSL GET - OK
req: curl -X POST -H "Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=" -H "Content-Type: application/x-www-form-urlencoded" -d 'username=q&passwd=q' "https://198.206.134.30/test_post" -k
res: TEST SSL POST - OK
** but only with parameter -k, --insecure Allow connections to SSL sites without certs **
Any ideas, how is possible do request on HTTPS server with selfsigned certificate, also with some parameter for doing connect without certs, like do it curl ?