Skip to content

Magento 2 – Error after setting Varnish host and port in purges when trying to save modifications to a product

I have configured the host and port to purge Varnish as it says in the official documentation:

bin/magento setup:config:set --http-cache-hosts=varnish_host:varnish_port

But when I try to save the modifications of a product for example, I get the following error in logs:

[2023-10-24 20:51:41] main.CRITICAL: No cache server(s) could be purged Cache host: host:port resulted in error message: Unable to connect to host:port . Error #0: stream_socket_client(): unable to connect to host:port (Connection timed out) {“method”:”POST”,”url”:”https://hostname/admin/catalog/product/save/id/1713369/type/simple/store/0/set/4/key/490cf9b0cfd68f1d33dda65d46d64d1f5e2cc41f6cf406c88c3bc12f91e1e41d/back/edit”,”invalidateInfo”:{“server”:”[object] (LaminasUriUri: http://host:port/)”,”formattedTagsChunk”:”((^|,)cat_p_1713369(,|$))”}} []

Important: Varnish is configured on another server, should I add some additional permission so that the purge is sent from the server where my application is to the server where Varnish is?