Forum Replies Created

Viewing 15 replies - 1 through 15 (of 22 total)
  • My plugin does not have this setting.

    You have no interest in the renamed login page for your plugin compatible with most of the caching plugins?

    It’s so simple, just add the code below to that specific page and you’re done.

    define( "DONOTCACHEPAGE", true );

    Thanks.

    I agree with you @bobsled, updating the plugin without thinking about the consequences or forcing a functionality is at least irresponsible.

    I will be forced to stop using this plugin because of this.
    It is impractical to receive spam and it is also impractical to have this recaptcha loading on all pages and leaving everything slower.

    Why remove support for recaptcha version 2 silently?

    Wonderful, it’s great to hear that!

    So I’ll wait anxiously. Thank you very much ๐Ÿ™‚

    Hello Emre,

    So I can request this feature?
    It’s something important to keep both plugins working.

    W3 Total Cache has a similar filter, as you can see:
    https://wordpress.org/support/topic/you-have-a-filter-equal-to-wp_cache_ob_callback_filter/

    Glad to know that I helped you. ๐Ÿ™‚

    If you have any other question, please do not hesitate to contact us.

    Maybe you should consider reading this page. CDN is a good resource for your site, and decreasing the size of images does not mean quality loss.
    In fact, the loss is not perceptible, unless you are paranoid with the quality of the image.
    And CDN greatly improves the speed of your site.

    Hello @awareman,

    Thanks for showing this bug to us.
    I added define( 'DISABLE_WP_CDN', true ); in your configuration file, which should disable the CDN feature completely on your site.

    Hello @bcworkz

    I was able to do what I wanted with your support, thank you!

    I’ve been working on it for over a year, with so many tests and studies. And the best way to do this is to make Varnish ignore the Cache-Control headers and create my own rules.

    All this to offer an easy solution for some people to cache their websites using Varnish Cache + WordPress, without the need for advanced knowledge or programming VCL.

    I love WordPress, I’m super fan of you guys and I’m creating with the best of my abilities a solution for some people who have a lot of access and little money to pay very expensive servers. ๐Ÿ™‚

    Thanks for the excellent work you guys have done and for the wonderful support.

    Hello @bcworkz,
    Thank you! ๐Ÿ™‚ You’re right. Is not the ideal solution.

    Due to the cache plugins (WP Super Cache, W3 Total Cache, etc.), some plugins (the most important ones at least) understand that they should use DONOTCACHEPAGE for more compatibility. This gave me this idea to improve the compatibility of my Varnish with some plugins.

    But, it’s just an add-on, in my VCL I have already configured that Varnish should skip some pages. For example:

    	if (req.url ~ "(?i)/wp-admin|/admin/|/adm/|/login/|/wp-(login|signup|activate|mail|cron)\.php|preview\=true|/xmlrpc\.php|/bb-admin|control\.php|bb-login\.php|bb-reset-password\.php|register\.php") {
    		if (req.url !~ "(?i)^[^?]*\.(bmp|css|gif|ico|jpeg|jpg|js|png|svg|svgz)(\?.*)?$") {
    			set req.http.X-BypassVarnish = "allready";
    			set req.http.X-BackendUncacheable = "admin-page";
    			return(pass);
    		}
    	}
    	if (req.url ~ "(?i)/(cart/|my-account/|checkout/|addons/|logout/|lost-password/)|(\?add-to-cart=|\?wc-api=)") { 
    		set req.http.X-BypassVarnish = "allready";
    		set req.http.X-BackendUncacheable = "admin-page";
    		return (pass); 
    	}
    	if (req.http.Cookie) {
    		if (req.http.Cookie ~ "(?i)wordpress_logged_in_|comment_|wp-postpass_") {
    			set req.http.X-BackendUncacheable = "cookie-session";
    			set req.http.X-BypassVarnish = "allready";
    			return(pass);
    		}
    	}

    This is only for some cases where some people rename the standard WooCommerce page or the WordPress administrative page.

    Itโ€™s conceivable a plugin simply outputs a no-cache meta tag and does not decide to do so until itโ€™s too late to send headers โ€” that Catch-22.

    And you’re right again, If the Header is not sent before, it will not have another chance, but the person can clear the cache manually when this happens or ask me to bypass the cache in VLC, it is not a very serious problem.

    Or they may output Cache-Control or Pragma headers only. You can check for these in the โ€œwp_headersโ€ filter, but if they are set by .htaccess rules, all PHP can do is read the file, searching for the appropriate Header set rules. Or does Varnish check for these headers anyway?

    By default, Varnish Cache work that way, analyzing the Cache-Control headers.
    But to get a higher cache hit rate on Varnish, I’d rather customize my cache completely.
    So I get a great saving of resources, minimally compromising the functionality of WordPress.

    The final code looks like this:

    	function donotcache() {
    		if(defined('DONOTCACHEPAGE') || defined('DOING_CRON') || is_admin() || $GLOBALS['pagenow'] === 'wp-login.php') {
    			// Do not set header if header has already been sent
    			if (!headers_sent() && $_SERVER['HTTP_X_SERVER'] == "blizhost-varnish") {
    				header("BypassVarnishCache: TRUE");if(!$_SERVER['HTTP_X_BYPASSVARNISH']){exit;}
    			}
    		}
    	}
    	function donotcache_filter($template) {
    		donotcache();
    		return $template;
    	}
    	add_filter( 'init', donotcache );
    	add_filter( 'template_include', donotcache_filter );

    I really appreciate your help and opinion! ๐Ÿ™‚

    Hello @bcworkz,

    Thank you for your time in such a detailed response.

    template_include actually work!

    function my_function($template) {
            if(defined('DONOTCACHEPAGE')) {
                    header("MyCustomHeader: 12345");
            }
            return $template;
        }
    add_filter( 'template_include', 'my_function' );

    I’m going to do a few more tests, but it works perfectly so far.

    What I’m going to do is much more complex.
    I will use this Header to communicate with the Varnish Cache (proxy server) and set when it should not cache some content.

    As Varnish Cache will only know that content can only be cached after actually accessing it, the connection will repeat itself.
    To save resources from the server, I set to stop processing the page once it realizes that it is the access that will be repeated and after sending the header.

    if(defined('DONOTCACHEPAGE') || defined('DOING_CRON') || is_admin()) {
    	if (!headers_sent() && $_SERVER['HTTP_X_SERVER'] == "blizhost-varnish") {
    		header("BypassVarnishCache: TRUE");
    		if(!$_SERVER['HTTP_X_BYPASSVARNISH']){ exit; }
    	}
    }

    Because of Varnish’s limitations as a proxy, this was the best way I found to do this.
    If it gets confusing, I can try to explain it another way.

    Note: The connection needs to be repeated because the cookies sent on the first access will be sent to the second. Limitation of Varnish Cache with cookies.

    @petjordan I’m not sure, but I believe this plugin does not make requests on admin-ajax.php.
    I’m using this plugin with a high traffic load too and the CPU is very light.

    The problem keeps happening, many requests on the “admin-ajax.php”.

    Hello,

    The problem has come back with the latest update.

Viewing 15 replies - 1 through 15 (of 22 total)