Ошибка:
Access to fetch at 'https://api.site.com/v1/user/me' from origin 'https://site.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
VM28124:71 GET https://api.site.com/v1/user/me net::ERR_FAILED
(анонимная) @ VM28124:71
fetch @ VM28124:70
get @ fetch-wrapper.js?967b:19
getMe @ user.service.js?3ce0:42
eval @ index.jsx?7ffd:11
commitHookEffectListMount @ react-dom.development.js?ac89:23150
commitPassiveMountOnFiber @ react-dom.development.js?ac89:24926
commitPassiveMountEffects_complete @ react-dom.development.js?ac89:24891
commitPassiveMountEffects_begin @ react-dom.development.js?ac89:24878
commitPassiveMountEffects @ react-dom.development.js?ac89:24866
flushPassiveEffectsImpl @ react-dom.development.js?ac89:27039
flushPassiveEffects @ react-dom.development.js?ac89:26984
performSyncWorkOnRoot @ react-dom.development.js?ac89:26076
flushSyncCallbacks @ react-dom.development.js?ac89:12042
commitRootImpl @ react-dom.development.js?ac89:26959
commitRoot @ react-dom.development.js?ac89:26682
finishConcurrentRender @ react-dom.development.js?ac89:25981
performConcurrentWorkOnRoot @ react-dom.development.js?ac89:25809
workLoop @ scheduler.development.js?bcd2:266
flushWork @ scheduler.development.js?bcd2:239
performWorkUntilDeadline @ scheduler.development.js?bcd2:533
VM28124:71 Uncaught (in promise) TypeError: Failed to fetch
at <anonymous>:71:39
at new Promise (<anonymous>)
at fetch (<anonymous>:70:18)
Хотя в NGINX прописаны правила:
add_header "Access-Control-Allow-Credentials" "true";
add_header "Access-Control-Allow-Headers" "*";
add_header "Access-Control-Allow-Methods" "*";
add_header "Access-Control-Allow-Origin" "*";
function get(url) {
const requestOptions = {
method: 'GET',
headers: authHeader(url),
};
return fetch(url, requestOptions).then(handleResponse);
}
С авторизацией было всё окей, а вот получение информации ошибка