Varnish never hits cache (Wordpress + Wordfence) #193

Closed
opened 2026-04-05 20:25:49 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @rkcreation on 8/29/2024

CloudPanel version(s) affected

2.4.2

Description

Varnish never hits cache, because controller.php is never included.
I have to include file manually in wp-config.php to make Varnish cache work.
After some digging, the auto_prepend_file directive added in vhost seems to be ignored, because Wordfence create a .user.ini file with auto_prepend_file directive.
Any idea to have compatibility?

How to reproduce

Use Wordpress site with Wordfence enabled, and enable Varnish in CloudPanel

Possible Solution

Use another directive?
Add this to nginx config :

location ~ ^/\.user\.ini {
  deny all;
}

Additional Context

No response

*Originally created by @rkcreation on 8/29/2024* ### CloudPanel version(s) affected 2.4.2 ### Description Varnish never hits cache, because controller.php is never included. I have to include file manually in wp-config.php to make Varnish cache work. After some digging, the auto_prepend_file directive added in vhost seems to be ignored, because Wordfence create a .user.ini file with auto_prepend_file directive. Any idea to have compatibility? ### How to reproduce Use Wordpress site with Wordfence enabled, and enable Varnish in CloudPanel ### Possible Solution Use another directive? Add this to nginx config : ``` location ~ ^/\.user\.ini { deny all; } ``` ### Additional Context _No response_
Sign in to join this conversation.