cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with purging Varnish cache

Issue with purging Varnish cache

I'm unable to purge Varnish cache.

 

What I have in my config:

 

'http_cache_hosts' => [
[
'host' => 'localhost',
'port' => '6081',
]
]

 

Here's what is sent to Varnish:

------

PURGE HTTP/1.1

X-Magento-Tags-Pattern: .*



------

 

Here's what I have in Varnish log:

 

*   << Request  >> 32814     
-   Begin          req 32813 rxreq
-   Timestamp      Start: 1449677605.365639 0.000000 0.000000
-   Timestamp      Req: 1449677605.365639 0.000000 0.000000
-   HttpGarbage    "PURGE%00"
-   ReqAcct        47 0 47 28 0 28
-   End 

 

I get "400 Bad request" from Varnish in

 

vendor/zendframework/zend-http/src/Client/Adapter/Socket.php:375

 

Sending the request in telnet is fine:

 

telnet 127.0.0.1 6081
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
PURGE / HTTP/1.1
X-Magento-Tags-Pattern: .*

HTTP/1.1 200 Purged
Date: Wed, 09 Dec 2015 16:07:31 GMT
Server: Varnish
X-Varnish: 65569
Content-Type: text/html; charset=utf-8
Retry-After: 5
Content-Length: 240
Accept-Ranges: bytes
Connection: keep-alive

<!DOCTYPE html>
<html>
  <head>
    <title>200 Purged</title>
  </head>
  <body>
    <h1>Error 200 Purged</h1>
    <p>Purged</p>
    <h3>Guru Meditation:</h3>
    <p>XID: 65569</p>
    <hr>
    <p>Varnish cache server</p>
  </body>
</html>

 

I think it is somehow related to missing path in the request, because sending  this via telnet also produces 400 response:

 

telnet 127.0.0.1 6081
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
PURGE HTTP/1.1
X-Magento-Tags-Pattern: .*

HTTP/1.1 400 Bad Request

 

Tags (2)