Reputation: 3570
I am trying to develop a single page application (SPA) that uses as endpoint a domain that is different from the one hosted in the SPA domain (ie: site.com
and site-api.com
or api.site.com
).
Access Control headers are already set up in the back-end, Max-Age
included, however it does not seem to work.
Here's an example of what happens if I perform the same call multiple times:
These are the server headers:
AUTHORIZATION,CONTENT-TYPE
PATCH
http://tovertaal.test:3000
600
Shouldn't Max-Age
600 prevent every other OPTIONS
request within 600 seconds from the first OPTIONS
request?
The server endpoint is http://tovertaal-api.test.
Upvotes: 9
Views: 1515
Reputation: 3570
I have finally discovered what was the issue. It seems like Chrome DevTools, when disable cache is active, also disables CORS Origin cache, so it keeps triggering OPTIONS
request for stuff that should have been cached already.
Make sure to keep caching enabled if you want to test it!
Upvotes: 4