Trying to send a POST request to a Linux server from a Windows 7 virtual machine using VirtualBox was initially met with CORS issues. To resolve this, I installed the 'Allow-Control-Allow-Origin:' Chrome extension '*'. The CORS problem was fixed, but now I am seeing the message: "POST http://servidor.hanbai:8081/api/aa/v1/pedidos 500 (Request failed.)"
In addition, there is a warning about Cross-Origin Read Blocking (CORB) blocking the response from with MIME type application/vnd.sun.wadl+xml. More details can be found at .
Interestingly, when testing with POSTMAN, no issues arise. Any idea what might be causing this?
function sendToHanbai(order) {
console.log(order);
let createdOrderUrl;
$.ajax({
type: "POST",
url: "http://servidor.hanbai:8081/api/aa/v1/pedidos",
data: JSON.stringify(order),
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
success: function(data, status, request) {
console.log(data);
console.log(status);
console.log(request);
createdOrderUrl = request.getResponseHeader('location');
console.log(createdOrderUrl);
const regex = /(?<=pedidos\/).*$/gi;
let match = regex.exec(createdOrderUrl);
let createdOrderId = match[0];
console.log(createdOrderId);
renderSuccessDivWithCreatedOrder(createdOrderId);
},
error: function (data, status, request) {
console.log(data);
console.log(request);
console.log(status);
console.log("Error sending order to Hanbai");
}
});
}