I am quite new to varnish however I have configured varnish in my Dev environment and seems to be going well.
The cache however doesn't seem to flush with Magento. Subsequent requests however remain lightening quick with the old content until refreshing the page on a client PC which them seems to reload the page properly and update the cached page.
I have run the below command to update the cache host:
bin/magento setup:config:set --http-cache-hosts=localhost:80
I was unsure about the port whether 6082 or 80 but checking for purge requests with below command shows results when running a cache refresh:
varnishlog -g request -q 'ReqMethod eq "PURGE"
* << Request >> 98314 - Begin req 98313 rxreq - Timestamp Start: 1511438530.550488 0.000000 0.000000 - Timestamp Req: 1511438530.550488 0.000000 0.000000 - ReqStart ::1 41502 - ReqMethod PURGE - ReqURL / - ReqProtocol HTTP/1.1 - ReqHeader X-Magento-Tags-Pattern: .* - ReqHeader Host: localhost - ReqHeader X-Forwarded-For: ::1 - VCL_call RECV - VCL_acl MATCH purge "localhost" - VCL_return synth - VCL_call HASH - VCL_return lookup - Timestamp Process: 1511438530.550571 0.000083 0.000083 - RespHeader Date: Thu, 23 Nov 2017 12:02:10 GMT - RespHeader Server: Varnish - RespHeader X-Varnish: 98314 - RespProtocol HTTP/1.1 - RespStatus 200 - RespReason OK - RespReason Purged - VCL_call SYNTH - RespHeader Content-Type: text/html; charset=utf-8 - RespHeader Retry-After: 5 - VCL_return deliver - RespHeader Content-Length: 226 - Storage malloc Transient - RespHeader Accept-Ranges: bytes - Debug "RES_MODE 2" - RespHeader Connection: keep-alive - Timestamp Resp: 1511438530.550634 0.000145 0.000062 - ReqAcct 65 0 65 218 226 444 - End
I have tried restarting varnish however the cache remains. This is becoming an issue when testing deploying new static content as some resources become unavailable having old urls stored in the cache.
curl -I -v --location-trusted 'http://dev.magento2.com'
Does return a MISS once cache cleared / flushed in magento. This was run from the web server. Second request will then return HIT as cache has been rebuilt. Just my client PC seems to behave like a hit until i click refresh.
Why do i still need to refresh the page on my client PC in order for the content to update?