I have never used HTTP Caching.
I found those caching options on Symfony documentation page.
I just wanted to know what's the difference between expires
, max-age
, and s-maxage
headers?
Shortly: Expires
is understand by HTTP/1.0 agents, whereas Cache-control: max-age=
was introduced in HTTP/1.1. s-maxage
is similar to max-age but it applies to proxies instead of clients.
Cache-Control:
Was introduced in HTTP/1.1 and supersedes previous headers (e.g. Expires) used to define response caching policies. All modern browsers support Cache-Control, hence that is all we will need.
Expires:
While the Cache-Control header turns on client-side caching and sets the max-age of a resource, the Expires header is used to specify a specific point in time the resource is no longer valid.
max-age:
Used on both client and proxy for content expiration
s-maxage:
Used only by the proxy for content expiration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With