I'm serving a website with nginx. The site is all static files, with the exception of /api
being proxied to my API process internally. I'm running some site speed tests, and I keep getting results saying /api/<whatever>
needs cache control. Specifically:
The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources: ...
and
The following resources are missing a cache validator. Resources that do not specify a cache validator cannot be refreshed efficiently. Specify a Last-Modified or ETag header to enable cache validation for the following resources: ...
My server isn't returning any caching information whatsoever for the API--I don't want the API cached. Both ETag
and Last-Modified
are sent for the resources that actually are static.
What's the proper way to handle this with nginx? What do I need to enable or disable to set the API to never be cached?