A
A
Alice2021-04-04 23:27:31
CORS
Alice, 2021-04-04 23:27:31

Why does a request sometimes fail CORS validation?

Why only sometimes the request fails CORS validation?
When accessing https://lazuren.ru/ (SPA) through a browser, it receives data via the API and sometimes requests to the same endpoint do not pass the CORS check.
To visually see what I'm talking about, refresh the page several times and look at the development panel.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2021-04-04
@Rsa97

Because there are no CORS headers in the responses.
lazuren.ru and api.lazuren.ru are two different domains, and when a page opened from one domain accesses another domain, the browser requires CORS headers either in the response to the request itself or in response to the OPTIONS pre-request.
https://developer.mozilla.org/en/docs/Web/HTTP/CORS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question