I have recently found that we use Cache-Control:no-cache
in all the WebApi responses. I know that before browsers caching did vary a lot and you never knew if the browser can cache you json, so it was important.
As far as I remember now, no modern browser is caching ajax responses so this header is not needed. But I would really like to double check and ask here about the behavior, since could not found any recent posts on the topic.
So the question really is: Do we still need to set Cache-Control:no-cache
for web api calls from SPA application and if yes, then which browsers do the caching?
According to HTTP/1.1 specification browser HTTP cache key is a combination of a request HTTP method and URI. Browser doesn't take into consideration how request was made:
The primary cache key consists of the request method and target URI. However, since HTTP caches in common use today are typically limited to caching responses to GET, many caches simply decline other methods and use only the URI as the primary cache key.
So if requests that you perform are cacheble you still need that header value. Check HTTP Caching MDN page and Which webbrowsers use http/1.1 by default? question for more details.
Also you may need to add another headers for IE specifically. Check Make IE to cache resources but always revalidate question for more information.