Lessons

The "Expires" header

The page consists of dozens of files, and 95% of the files can be shared by all pages of the site. Caching was invented to avoid downloading this information every time.

There are 3 caching mechanisms:

  • The “cache-control” or “expires” headers indicate how long the content will be relevant. During this time, the user’s browser uses the saved copy of the file and does not make any requests to the server.
  • Caching via “etag”. The server generates a unique string based on the content and the user’s browser asks each time if the file has changed and provides this string.
  • The title is “Last-Modified”. The server reports the date of the last file change, and the browser asks each time if the file has changed since that time.

If the server does not use the “cache-control” or “expires” headers when submitting files, the browser will request them every time the page is visited. This will slow down the speed of work.

Instruction [How to set up caching] (/blog/apache_i_nginx_tyuning_bystrodeystviya).

Check your website
It's free and will take from 11 to 45 seconds

We use cookies. By continuing to use the site, you agree to the processing of personal data in accordance with privacy policy. I agree