In an AngularJS app I'm posting a form to a payment gateway. I have a header field called "Authorization" to pass my session token to the backend API.
When trying to make a request to the payment gateway I get the following error:
XMLHttpRequest cannot load https://transact.nab.com.au/test/directpostv2/authorise. Request header field Authorization is not allowed by Access-Control-Allow-Headers.
When making the same request using Postman everything works fine, with a 200 status code.
I've created a plunkr for a quick demo which also gets a 200 status http://plnkr.co/edit/8Ts6s0VDTTUVVC9dbCJC
$http({
method: 'POST',
url: authoriseURL,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
data: nabPaymentData
}).
success(function (response, status, headers) {
alert('Success:' + response + ' status:' + status + ' headers:' + headers);
}).
error(function (err, status, headers) {
alert('Error:' + err + ' status:' + status + ' headers:' + headers);
});
Is there a way to strip header fields for one single post request?