Axios CORS не может увидеть ни одного заголовка ответа

Здравствуйте, у меня есть фронтенд, обслуживаемый для тестирования из localhost, делающий запрос к бэкенду, работающему на api.whatify.io, который является сервером Nginx перед бэкендом Django.

Код клиентского приложения:

const axiosApi = axios.create({
  baseURL: API_URL,
  withCredentials: true,
})

export async function post(url, data, config = {}) {
   return axiosApi
    .post(url, {...data }, {withCredentials: true})
    .then(response => response.data)
    .then(response => {
        console.log("response is", response);
        console.log("WOW GOT", response.headers);
        console.log("CUSTOM", response.headers.get("Cache-Control"));
    })

}

Заголовки запроса и ответа выглядят следующим образом, как видно из браузера:

Request URL: https://api.whatify.io/auth/login
Request Method: POST
Status Code: 302 
Remote Address: 54.194.218.202:443
Referrer Policy: strict-origin-when-cross-origin

Response Headers:

access-control-allow-credentials: true
access-control-allow-origin: http://localhost:5173
access-control-expose-headers: accept, accept-encoding, authorization, content-type, dnt, origin, user-agent, x-csrftoken, x-requested-with, cache-control, pragma, Set-Cookie
content-length: 0
content-type: text/html; charset=utf-8
cross-origin-opener-policy: same-origin
date: Sun, 05 Feb 2023 01:21:28 GMT
location: /
referrer-policy: same-origin
server: nginx/1.21.6
set-cookie: csrftoken=zaBGdsPdVSEm1ZRvgNKuGxQcr2mRJvhh; expires=Sun, 04 Feb 2024 
 01:21:28 GMT; Max-Age=31449600; Path=/; SameSite=None; Secure
set-cookie: sessionid=z3gygehf6gcwuc5pdq2v8kzff61ipcss; expires=Sun, 19 Feb 2023 01:21:28 GMT; HttpOnly; Max-Age=1209600; Path=/; SameSite=None; Secure
vary: Origin, Cookie
x-content-type-options: nosniff
x-frame-options: DENY

Заголовки запросов

:authority: api.whatify.io
:method: POST
:path: /auth/login
:scheme: https
accept: application/json, text/plain, */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
content-length: 44
content-type: application/json
origin: http://localhost:5173
referer: http://localhost:5173/
sec-ch-ua: "Not_A Brand";v="99", "Google Chrome";v="109", "Chromium";v="109"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: cross-site
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

В консоли я пытаюсь записать заголовки ответа, когда я получаю ответ:

  console.log("WOW GOT", response.headers); // prints WOW GOT undefined

Почему нет заголовков, доступных клиенту axios, когда я могу видеть их в браузере?

Вернуться на верх