var auth_headers = { 'X-Auth-Date': '2018-09-22 15:35:05Z', 'X-Authorization': 'gcn:0d58b4e9fc77050b67dd54774a34238cf44c110aec47f29faab63fd2b09d9d64017fbf62206a74e4982c9cadee6c4548d052bb6ff103521f5ec6bb568aa63123' } $.ajaxSetup({ 'headers':auth_headers, 'error':function (jqXHR, textStatus, errorThrown) { if (jqXHR.status == 403) { window.location.reload(); } } });