I use AWS API Gateway and call it form an Web-App (just jQuery, no Frameworks).
When I call it from code like this, it works:
const sBaseURLNotify= 'https://<my-id>.execute-api.eu-west-1.amazonaws.com/STAGE_default';
$.ajax({
method: 'PUT',
crossDomain: true,
contentType: 'application/json',
url: this.sBaseURLNotify+'/register_notfication',
headers: {
'Authorization': featureLogin.oUser.AccessToken
},
data: JSON.stringify({
oSubscription: JSON.stringify(oSubscription),
}),
success: function(data, status) {
console.log('data', data);
},
error: function(xhr, ajaxOptions, thrownError) {
console.log('thrownError:', thrownError);
sessionStorage.setItem('oSubscription9', 'none');
sessionStorage.setItem('iSubscriptiondate', Date.now());
},
});
When I instead use the Custom Domain name I set up, it throws the error “Unauthorized”
I just exschange the first line to
const sBaseURLNotify= 'https://stage-api.<my domain name>.de/notification';
The URL seems to be correct, as the Error changes to “”, when I bring in a typo,
const sBaseURLNotify= 'https://stage-api.<my domain name>.de/ntification';
I assume anything in the Custom Domain messes with the “Authorization” header. But I can’t figure out what happens or what I can do about it.
Any suggestions are very welcome!