I have configured Varnish on my ubuntu server with apache. But varnish is showing a lot of repetitive purge requests and the site is extremely slow. What could be the reason behind it? I have magento 2.

Here is the varnishncsa.log: - - [27/Oct/2021:01:44:03 +0000] "PURGE http://domain.com/ HTTP/1.1" - - "-" "-" - - [27/Oct/2021:01:44:01 +0000] "PURGE http://domain.com/ HTTP/1.1" - - "-" "-" - - [27/Oct/2021:01:44:01 +0000] "PURGE http://domain.com/ HTTP/1.1" - - "-" "-" - - [27/Oct/2021:01:44:06 +0000] "PURGE http://domain.com/ HTTP/1.1" - - "-" "-" - - [27/Oct/2021:01:44:06 +0000] "PURGE http://domain.com/ HTTP/1.1" - - "-" "-" - - [27/Oct/2021:01:44:06 +0000] "PURGE http://domain.com/ HTTP/1.1" - - "-" "-"

My VCL file:

# This is an example VCL file for Varnish.
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.

# Marker to tell the VCL compiler that this VCL has been adapted to the
# new 4.0 format.
vcl 4.0;

# Default backend definition. Set this to point to your content server.
backend default {
    .host = "";
    .port = "8080";
    .first_byte_timeout = 600s;

sub vcl_recv {
    # Happens before we check if we have this in cache already.
    # Typically you clean up the request here, removing cookies you don't need,
    # rewriting the request, etc.

sub vcl_backend_response {
    # Happens after we have read the response headers from the backend.
    # Here you clean the response headers, removing silly Set-Cookie headers
    # and other mistakes your backend does.

sub vcl_deliver {
    # Happens when we have all the pieces we need, and are about to send the
    # response to the client.
    # You can do accounting or modifying the final object here.

1 Answer 1


An IP WHOIS showed that is actually a DigitalOcean IP address. Is this the IP address of the machine on which your Magento setup is hosted?

If not, someone has unauthorized access to your PURGE endpoint.

Please share your VCL file so we can have a look at how PURGE is implemented and how access is protected.

If it turns out is allowed to PURGE the cache, you might want to have a look at your Magento looks and increase the verbosity.

  • No, that's my own IP address. I have confirmed that. I have updated my question with vcl file. Oct 27, 2021 at 7:45
  • 1
    @AnishSapkota Your VCL is practically empty. There's no Magento-related logic in it. If that is your actual VCL file, the built-in VCL will not recognize the PURGE request method and "pipe" the request to the backend as described here: varnish-software.com/developers/tutorials/varnish-builtin-vcl/…. See varnish-software.com/developers/tutorials/… for an example of an actual Magento VCL file. Oct 27, 2021 at 8:08
  • Thank you for your instant reply. I don't know what the issue was. But it is solved after I configure it as: Nginx => Varnish => Apache Oct 28, 2021 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.