HTTP headers: Last-Modified - how can it simulate server load?

Imagine the following usage example:

I use the AJAX request to get information about Itemand use this URL: http: // domain / items / show / 1

In my database, all elements have a field called modified_atwhere we save the moment when this element was previously modified.

How an HTTP header Last-Modifiedin response can minimize load / reduce the number of requests / increase responsiveness if we need to process this request every time on the server side? It seems that we are not reducing the number of HTTP requests with this answer, and we are not reducing the server load.

Who needs this?

Am I right that it is mainly used to save bandwidth?

+5
source share
2 answers

The goal is to save bandwidth, not on your server, but on the client. Unused AJAX requests are likely to make the user interface incredibly slow for your visitors, rather than translating the data over and over, which dramatically improves performance in the client browser.

If you want to reduce the number of requests, you must set an explicit header Expiresin the response. The client will not request a resource until the time set has elapsed Expires.

+3
source

db, 304 . , . , , db.

, uri , .

, . ( , ) , etag ttl. ttl, , , , , 304 ( ), ( , ), , .

. 304 . HTTP Conditional PHP ?

+1

All Articles