Caching POST requests
When a client (web browser) wants a regular resource (eg a HTML document or an image) from a web server, it will make a GET request to the server. In a default installation, Varnish will cache such requests, and this will lessen the load on the conventional web server.
When a user logs in to a site, or provides some unique or private information, this will be done through a POST request. By default, Varnish will not cache POST requests, but pass them directly to the backend server, unmodified. This is typically a good idea, but sometimes it makes sense to also cache POST requests.
When two different users use POST towards a web server, we only want them to receive the same reply if they supplied the same request body. The solution is to make the request body a part of the hash, and let the normal caching logic happen. The result is that only clients who supply the same body will receive the the same reply.
This tutorial describes the steps needed to cache POST requests with Varnish.
Docs Varnish
When a client (web browser) wants a regular resource (eg a HTML document or an image) from a web server, it will make a GET request to the server. In a default installation, Varnish will cache such requests, and this will lessen the load on the conventional web server.
When a user logs in to a site, or provides some unique or private information, this will be done through a POST request. By default, Varnish will not cache POST requests, but pass them directly to the backend server, unmodified. This is typically a good idea, but sometimes it makes sense to also cache POST requests.
When two different users use POST towards a web server, we only want them to receive the same reply if they supplied the same request body. The solution is to make the request body a part of the hash, and let the normal caching logic happen. The result is that only clients who supply the same body will receive the the same reply.
This tutorial describes the steps needed to cache POST requests with Varnish.
Docs Varnish
Comments
Post a Comment