<div dir="ltr"><div><div>Hi all,</div><div> </div><div>I've set up Magento 2 (2.0.4 CE) and Varnish .</div><div> </div><div>Varnish seems to be working ok - pages are being cached and served from the cache (first page load takes a few seconds, next load takes 100 or so ms).</div><div> </div><div>The problem I have is trying to set up Magento to purge the Varnish cache when I flush the magento cache in the magento backend.</div><div> </div><div>I've set it up as described in the official magento docs using </div><div> </div><div>bin/magento setup:config:set --http-cache-hosts=127.0.0.1</div><div> </div><div>My /etc/varnish/default.cfg file has the purge acl set to 127.0.0.1 (I've also tried the external IP and localhost too).</div><div> </div><div>But when I hit Flush Magento Cache in admin, whilst running varnishlog, the log file says (amongst other things) - note, I've replaced my domain with {MY_DOMAIN} and my server IP with {SERVER_IP}</div><div><br></div><div>* << BeReq >> 32924</div><div>- Begin bereq 32923 pass</div><div>- Timestamp Start: 1459552787.509708 0.000000 0.000000</div><div>- BereqMethod POST</div><div>- BereqURL /app/etc/config.php</div><div>- BereqProtocol HTTP/1.1</div><div>- BereqHeader Host: {MY_DOMAIN}</div><div>- BereqHeader Accept: */*</div><div>- BereqHeader Content-Length: 0</div><div>- BereqHeader Content-Type: application/x-www-form-urlencoded</div><div>- BereqHeader X-Forwarded-For: {SERVER_IP}</div><div>- BereqHeader X-Varnish: 32924</div><div>- VCL_call BACKEND_FETCH</div><div>- VCL_return fetch</div><div>- BackendOpen 23 boot.default 127.0.0.1 8080 127.0.0.1 53519</div><div>- Timestamp Bereq: 1459552787.509933 0.000225 0.000225</div><div>- Timestamp Beresp: 1459552787.511332 0.001625 0.001399</div><div>- BerespProtocol HTTP/1.1</div><div>- BerespStatus 403</div><div>- BerespReason Forbidden</div><div>- BerespHeader Date: Fri, 01 Apr 2016 23:19:47 GMT</div><div>- BerespHeader Server: Apache/2.4.7 (Ubuntu)</div><div>- BerespHeader Content-Length: 299</div><div>- BerespHeader Content-Type: text/html; charset=iso-8859-1</div><div>- TTL RFC -1 10 -1 1459552788 1459552788 1459552787 0 0</div><div>- VCL_call BACKEND_RESPONSE</div><div>- TTL VCL 0 10 0 1459552788</div><div>- VCL_return deliver</div><div>- BerespUnset Content-Length: 299</div><div>- BerespHeader Content-Encoding: gzip</div><div>- BerespHeader Vary: Accept-Encoding</div><div>- Storage malloc Transient</div><div>- ObjProtocol HTTP/1.1</div><div>- ObjStatus 403</div><div>- ObjReason Forbidden</div><div>- ObjHeader Date: Fri, 01 Apr 2016 23:19:47 GMT</div><div>- ObjHeader Server: Apache/2.4.7 (Ubuntu)</div><div>- ObjHeader Content-Type: text/html; charset=iso-8859-1</div><div>- ObjHeader Content-Encoding: gzip</div><div>- ObjHeader Vary: Accept-Encoding</div><div>- Fetch_Body 3 length -</div><div>- Gzip G F E 299 259 80 1992 2002</div><div>- BackendReuse 23 boot.default</div><div>- Timestamp BerespBody: 1459552787.511812 0.002104 0.000479</div><div>- Length 259</div><div>- BereqAcct 191 0 191 160 0 160</div><div>- End</div><div><br></div><div>So Varnish is correctly being asked to purge via the magento backend, but it's throwing a 403 error.</div><div><br></div><div>It works via telnet both via 127.0.0.1 and the real IP of the server</div><div> </div><div>telnet 127.0.0.1 80</div><div>Trying 127.0.0.1...</div><div>Connected to 127.0.0.1.</div><div>Escape character is '^]'.</div><div>PURGE / HTTP/1.1</div><div>X-Magento-Tags-Pattern: .*</div><div><br></div><div>HTTP/1.1 200 Purged</div><div>Date: Fri, 01 Apr 2016 23:39:08 GMT</div><div>Server: Varnish</div><div>X-Varnish: 229397</div><div>Content-Type: text/html; charset=utf-8</div><div>Retry-After: 5</div><div>Content-Length: 241</div><div>Accept-Ranges: bytes</div><div>Connection: keep-alive</div><div><br></div><div><!DOCTYPE html></div><div><html></div><div> <head></div><div> <title>200 Purged</title></div><div> </head></div><div> <body></div><div> <h1>Error 200 Purged</h1></div><div> <p>Purged</p></div><div> <h3>Guru Meditation:</h3></div><div> <p>XID: 229397</p></div><div> <hr></div><div> <p>Varnish cache server</p></div><div> </body></div><div></html></div><div><br></div><div>Connection closed by foreign host.</div><div> </div><div>Any ideas please?</div><div> </div><div>Thanks</div></div><div>John</div><div><br></div>
</div>