expires is a Web server response message header field that, in response to an HTTP request, tells the browser that the browser can cache data directly from the browser before the expiration time, without having to request it again.
Cache-control is consistent with expires, which indicates the validity of the current resource, whether the browser caches data directly from the browser or re-sends the request to the server. But Cache-control more choice, more detailed settings, if set at the same time, its priority is higher than expires.
1, the common value of HTTP protocol Cache-control and its combination of interpretation:
No-cache: The data content cannot be cached, each request is re-accessed to the server, and if there is max-age, the server is not accessed during the cache.
No-store: Not only can not cache, even staging is not possible (that is, the temporary folder cannot be staged in the resource)
Private (default): Only in the browser cache, only when the first request to access the server, if there is max-age, the cache during the server is not accessed.
Public: can be cached by any buffer, such as: Browser, server, proxy server, etc.
Max-age: The relative expiration time, which is the cache time in seconds.
No-cache, Private: Re-access the server when a new window is opened, and if Max-age is set, the server is not accessed during the cache.
Private, Positive max-age: Do not access the server when back
No-cache, Positive max-age: accesses the server when back
2. Setting Cache-control in a request message or response message does not affect the caching process in another message processing process.
the cache instructions for the request include No-cache, No-store, Max-age, Max-stale, Min-fresh, only-if-cached, and so on.
The directives in the response message include public, private, No-cache, No-store, No-transform, Must-revalidate, Proxy-revalidate, and Max-age.
3, Nginx settings:
1) If expires is not configured in Nginx, the default in response is Cache-control:private
2) Set EXPIRES-1, the response is Cache-control:no-cache
3) Add_header Cache-control No-store can be set in the response; The response is:cache-control:private cache-control:no-store
Location ~ ^/{ expires-1; #add_header Cache-control No-store; Proxy_pass http://api.yuedu.web; }
The above describes the HTTP Cache-control, including the control,cache aspects of the content, I hope that the PHP tutorial interested in a friend helpful.