danmuc
Forum Replies Created
-
Forum: Plugins
In reply to: [W3 Total Cache] Cached Version of XML Sitemap is not loaded by nginxHi Marko,
thanks for your reply. I tested with Yoast Sitemap and also with Google XMP Sitemaps Plugins both are not working. “Set Expires Header” is checked in HTML&XML Area.Only pages in XML Format are not getting cached (but the cache files for sitemaps exist in the page_enhanced folder…) but for some reason nginx does not load them correctly?
Here is the part of page_enhanced in nginx.conf for me it looks good…
# BEGIN W3TC Page Cache core set $w3tc_query_string $query_string; if ($w3tc_query_string ~* "^(.*?&|)utm_source(=[^&]*)?(&.*|)$") { set $w3tc_query_string $1$3; } if ($w3tc_query_string ~* "^(.*?&|)utm_medium(=[^&]*)?(&.*|)$") { set $w3tc_query_string $1$3; } if ($w3tc_query_string ~* "^(.*?&|)utm_campaign(=[^&]*)?(&.*|)$") { set $w3tc_query_string $1$3; } if ($w3tc_query_string ~* "^(.*?&|)gclid(=[^&]*)?(&.*|)$") { set $w3tc_query_string $1$3; } if ($w3tc_query_string ~* "^(.*?&|)instance_id(=[^&]*)?(&.*|)$") { set $w3tc_query_string $1$3; } if ($w3tc_query_string ~* "^(.*?&|)instance_secret(=[^&]*)?(&.*|)$") { set $w3tc_query_string $1$3; } if ($w3tc_query_string ~ ^[?&]+$) { set $w3tc_query_string ""; } set $w3tc_request_uri $request_uri; if ($w3tc_request_uri ~* "^([^?]+)\?") { set $w3tc_request_uri $1; } set $w3tc_rewrite 1; if ($request_method = POST) { set $w3tc_rewrite 0; } if ($w3tc_query_string != "") { set $w3tc_rewrite 0; } if ($w3tc_request_uri !~ \/$) { set $w3tc_rewrite 0; } if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle)") { set $w3tc_rewrite 0; } set $w3tc_preview ""; if ($http_cookie ~* "(w3tc_preview)") { set $w3tc_preview _preview; } set $w3tc_ssl ""; if ($scheme = https) { set $w3tc_ssl _ssl; } if ($http_x_forwarded_proto = 'https') { set $w3tc_ssl _ssl; } set $w3tc_ext ""; if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$w3tc_request_uri/_index$w3tc_ssl$w3tc_preview.html") { set $w3tc_ext .html; } if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$w3tc_request_uri/_index$w3tc_ssl$w3tc_preview.xml") { set $w3tc_ext .xml; } if ($w3tc_ext = "") { set $w3tc_rewrite 0; } if ($w3tc_rewrite = 1) { rewrite .* "/wp-content/cache/page_enhanced/$http_host/$w3tc_request_uri/_index$w3tc_ssl$w3tc_preview$w3tc_ext" last; } # END W3TC Page Cache core
Hi Marko,
thanks for your reply. Calling via curl is no option for us because we want to save nginx ressources.
Is there any way how we can define this host variable in functions.php or via a hook or something else?
But i am wondering why there is also no call to memcached server. When the hostname for key is used and hostname is empty in php-cli then i expect that maybe the key for the stored object is something like 123123__objectcache_[…] instead of 123123_hostname.com_objectcache so the hostname is empty which should lead to that the php-cli would also cache on second request via cli? But it does not you can test it with my script which i sent you above. I guess it’s a bug inside w3tc
I investigated that problem a little bit more and it’s reproducable. I also turned on memcached verbose logging and found out that dbcache is working on cli but there is not any GET or SET command incoming which is related to objectcache…
How to reproduce..
Create test.php in your wordpress main directory
<?php require_once ('wp-load.php'); $cached_object = wp_cache_get('test','test'); if ($cached_object === FALSE){ echo 'cached object not found setting it'; wp_cache_set('test', 'test '.date("D.m.Y - H:i:s"), 'test', 86400); }else{ echo 'cached object found: '.$cached_object; }
Call test.php via Browser… at first call it will show you not found and will set key.. on second call it will found old cache entry and show you old time.
Now open terminal and cd to wordpress directory enter “php test.php” you will always see message “cached object not found”
- This reply was modified 5 years, 9 months ago by danmuc.