1. Adobe Commerce Developer Documentation - Configure Varnish: The default Varnish Configuration Language (VCL) file provided for Adobe Commerce explicitly bypasses the cache for requests that are not GET or HEAD. The logic in the vclrecv subroutine typically includes a condition like: if (req.method != "GET" && req.method != "HEAD") { return (pass); }. This pass directive instructs Varnish to send the request directly to the backend
bypassing any cache lookup.
Source: Adobe Commerce Developer Documentation
"Get the Varnish VCL file". The default VCL files for various Varnish versions can be found in the magento/magento2 repository under app/code/Magento/PageCache/etc/varnish/.
2. RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content: This specification defines the cacheability of different HTTP methods.
Section 4.3.3 (POST): "Responses to POST requests are only cacheable when they include explicit freshness information... However
POST caching is not widely implemented." In practice
caches like Varnish do not cache POST by default.
Section 4.3.4 (PUT): The specification implies non-cacheability as it modifies a resource. Caching a response to a state-changing request is generally unsafe.
Section 4.3.1 (GET): "Responses to GET requests are cacheable..."
Source: IETF RFC 7231
Sections 4.3.1
4.3.3
4.3.4. (DOI not applicable for RFCs
can be found at https://datatracker.ietf.org/doc/html/rfc7231).