Client Caching (Validation)

Client Caching (Validation)

This concern adds an eTag header to every response generated by the server so that clients send a If-None-Match header to validate their cache. If the content did not change on the server, the handler will generate a 304 Not Modified response, causing the client to re-use the locally cached data. This way, clients revisiting your web application load faster and the load on your server is reduced.

var content = Layout.Create()
                    .Add(ClientCache.Validation());

The eTag is generated from the checksum of the content that should be served to the client. Dependent on the kind of content (such as a local file resource) the checksum can be calculated quite efficiently.

This concern is part of the default configuration and will automatically be added to your server.

Share