Differences between S-maxage and maxage

I need to understand, use the s-maxage header for caching, is there any example that will help me understand in what cases should I use both s-maxage and max-age ?

+5
source share
1 answer

As suggested by this comment :

For reverse proxies or other server caches, it might make sense to have a shorter s-maxage than maxage .

The reverse caching proxy will be able to serve the same resource for any number of clients as long as s-maxage . The proxy load will increase with the number of clients, so a simpler proxy server check ( s-maxage ) may be required than requests from downstream clients (for example, browsers) ( maxage ).

To give a more specific example: you can assume that the CDN should regularly (hourly) check the updated resource on the origin server. However, it may be good if any end-user continues to use the response they receive for several days; users with cold caches will receive an updated version.

+5
source

Source: https://habr.com/ru/post/1258070/


All Articles