I am having an issue with good old IE11/edge in compatibility mode. My code works fine in all other browsers.
I have a simple XMLHtmlRequest from javascript on https://localhost
request.open('POST', 'https://localhost:5000/api/request', true);
request.setRequestHeader('Content-Type', 'application/json');
// request.withCredentials = true;
request.send(JSON.stringify({
payload: {
payment: {
name: appliance.payment.name,
amount: appliance.payment.amount,
reference: appliance.payment.reference,
merchantaccount: appliance.payment.merchantaccount,
merchantprovider: appliance.payment.merchantprovider,
},
api: revopci.session
}
}));
request.onreadystatechange = function () {
if (request.readyState == 4) {
// XMLHttpRequest.DONE == 4
var result = request.responseText
console.log("result", result)
if (result) {
receive(command, result);
} else {
receive(command, '');
}
}
};
on the server (https://localhost:5000) i have following:
var corsOptions = {
origin: 'https://localhost',
preflightContinue: true,
allowedHeaders: "Content-Type,application/json",
methods: "GET,POST",
optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
}
app.use(cors(corsOptions));
router.post('/request', (req, res) => {
axios.post('API_SERVER_URL', data, {
headers: {
'X-SessionId': api.id,
'X-Auth': api.authKey,
}
}).then(result => {
console.log(result)
let resultCode, resultMessage
if (!result.data.rawResponse) {
resultCode = "-1"
resultMessage = "WorldPay authentication failed."
} else {
resultCode = "0"
resultMessage = result.data.data.paymentStatus
}
res.status(201).send("Success")
}
).catch(error => console.log("Error", error))
})
All iam getting now in IE is the error: XMLHttpRequest: Network Error 0x80070005, Access is denied.
I have looked evrywhere on SO and other forums but could find working answer. Also, one suggested changing internet options settings but that doesnt work.
Any help would be appreciated.