Open SajjadHadi opened 3 years ago
Access-Control-Allow-Origin
is a response header you need to add this header to the response from your server. More likely you should add cache-control
as a response header.
Also checkout Preventing caching on MDN
Hello, I've just deployed a nuxt app to the server, but it caches in a bad way. in any device, logged in or not, I get one user information, it's cookie and token! I tried to find out what is the problem, I searched and now I think because
cache-control: public
withmax-age=31536000
, now I've tried to set it toprivate
orno-cache
.I have two questions:
which
cache-control
value should I use?private
orno-cache
, etc? or even is this problem is because of caching?when I try to set headers of axios in
nuxt.config.js
, I get this error:Access to XMLHttpRequest at 'url of the backend' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field cache-control is not allowed by Access-Control-Allow-Headers in preflight response.
I've tried to set
Access-Control-Allow-Headers
but it did'n work and gives me same error like above, mynuxt.config.js
, the axios part is like this:thank you.