Last active
May 1, 2021 19:48
-
-
Save paoloumali/a52bd3e5fd0265f71422603713f9df48 to your computer and use it in GitHub Desktop.
http caching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTTP caching is a scheme of showing same resource unless content needs to be regenerated by fetching it again from the web server. | |
HTTP objects may be a static resource or a dynamic page built by some backend language like PHP. | |
Tools used are (1) HTTP Reverse Proxy, e.g. Varnish and HAProxy. Cache server is hit first before web server. All fetch resource will be cached locally first by the proxy before sending it to the client. If cache is hit, web server won't be touched at all, i.e. no access log entry will be appended. Only the first request is slow. | |
Another tool used is HTTP Browser cache. It relies on headers ETag and Cache-Control | |
Apache Cache-Control | |
FileETag None | |
ExpiresActive On | |
ExpiresDefault "access plus 1 week" | |
ExpiresByType text/css "access plus 1 year" | |
How to force clearing of HTTP cached resources from the origin end? Use cache-busting. When your backend team requires the client to clear browser cache, then they are not deploying it right. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment