HTTP headers are used to transfer meta information for a web page. The best known is probably the HTTP Status Code, which describes whether the web page was successfully retrieved and what the browser should do with the page. The most important optional use case for the headers is the caching behavior. But also the information whether for example the content of a website should be compressed before transmission is hidden in the headers.
The HTTP Header Check of Leankoala is used to check important headers for their presence. In addition, the value of the header can be compared with a stored value and an alarm can be sent in case of deviations.
The HTTP Header Check runs once per hour and takes regular expressions as parameters.
Check cache header
Over the years many possibilities have arisen to use HTTP headers for caching. For simplicity's sake, we will only show you an example here (more information about caching). If you don't want a web page to be cached by the browser, because you want to show the user always the most current data, set the Cache-Control Header to no-cache. The test in Leankoala is accordingly simple. The key to be entered in the check form is "cache-control" and the value is "no-cache". Done.
Age header is not zero
High traffic websites often have an additional caching layer implemented like a reverse proxy, for example a varnish. In many cases, such a cache sets an age header that describes how old the pages are. In the case of a well-known editorial website with thousands of visitors who want to read the same article, it makes sense not to make the server produce a response for every visitor.
In this case, only the first visitor actually produces load on the server and is given an age = 0. All subsequent requests will get a value greater than zero. If only one of thousands of visitors gets an age header = 0 as an answer, it is statistically unlikely that the Leankoala test will produce this request. If this should be the case, there is a good chance that an error has occurred in the additional caching layer.
With Leankoala this check looks like this: The key of the check is "age" because we want to check the age header. The value is not quite as trivial in this case. Leankoala processes regular expressions. These must be used here. The appropriate value here is "^(?!0+$)\d+$".