Comments (13)
I can explain parts of it anyway....
The worker serves the cached HTML immediately and then asynchronously updates the cached version from the origin when it doesn't see the headers from the plugin. That way if the plugin isn't installed and purge isn't working it will still stay up to date. That's what "Hit, Refreshed" refers to. This is likely because of W3TC which serves the HTML from disk directly from the web server and never gets a chance to add the header (which is also why you don't see it). If you are sure the plugin is installed and purging you can disable the code here.
-1 is normal for the version number when KV isn't used and it doesn't change. It is only used with KV.
As far as the worker stats go for subrequests, that's not unexpected if it is refreshing the cahced items. The main dashboard should have a view of the cache hit rate for the top-level requests.
from templates.
from templates.
Also, I noticed that wordpress_test_cookie
can also resulting in bypassing of the worker cache
from templates.
OK, that makes sense! :)
So the plugin is 100% installed and activated on my site... is there a clear and simple way to verify that it is actually doing what it should be doing? In terms of the W3TC page caching, I'm currently using APCu (not Disk) for the page caching:
OK, good to know on the -1 front! I'm assuming (although the Cloudflare documentation is a bit inconsistent at the moment) that KV does not come along with the free plan (of which I'm currently using) and requires the paid for workers as a minimum. Some documentation says it's included, other documentation says it's not.
As a slight side note/to clarify - do I also need a page rule applied, to allow for full/optimal functionality or can that now be completely ignored as is replaced in its entirety by the worker (which takes in to account the cookies)?
from templates.
from templates.
Thanks @pmeenan! Updated Page Rule and have applied, will monitor from there as well :)
As an aside, I will log a ticket with the guys at W3TC to see if they can add some form of support for this implementation.
One final question (slightly off topic!), my site runs a service-worker (network first) - is there anything that needs to be included within that so that everything runs perfectly alongside the CF Worker?
from templates.
Thanks @pmeenan - is it worthwhile me disabling W3TC Page Caching (only, object, database and browser would still remain) in place of the provided plugin?
from templates.
from templates.
Have disabled W3TC cache and now I'm seeing the following on my home page consistently.
x-html-edge-cache: cache,bypass-cookies=wp-|wordpress|comment_|woocommerce_
x-html-edge-cache-status: Miss
x-html-edge-cache-version: -1
I have just cleared the comment cookies (because I was making sure pages wouldn't cache with comment form data) and I'm still seeing the same on the home page, but now not on the individual post pages (x-html-edge-cache-status: miss, cached
) and then hit
on next visit
from templates.
@pmeenan also FYI: https://wordpress.org/support/topic/potential-support-for-cloudflare-worker-caching-plugin/ :D
from templates.
from templates.
Great news @pmeenan - one of the guys from Cloudflare (CC: @signalnerve) reached out to W3TC as well on the support req. I logged 😁 Very exciting stuff here!!!
As an aside... any idea on why I might just see a straight up "miss" response for my homepage? #41 (comment) - never seems to cache from there-on-in 😞
from templates.
Closing this issue because the initial question was addressed. Also the templates have moved over to the worker-sdk monorepo: https://github.com/cloudflare/workers-sdk/tree/main/templates.
if you're still experiencing issues feel free to open an issue there.
from templates.
Related Issues (20)
- In worker-rust template update `worker` dependency to 0.0.11 HOT 1
- WHIP and WHEP templates are not properly working in Firefox
- worker-rust build command does not work HOT 2
- worker-mysql build fail
- worker-mysql does not work well MySQL-compatible database HOT 1
- Typo in "about" section
- Error: EXDEV: cross-device link not permitted HOT 2
- Ship a prettier/editorconfig with every template
- Uncaught ReferenceError: jQuery is not defined HOT 12
- POST /wp-admin/admin-ajax.php 403 (Forbidden) HOT 2
- Wordpress multisite HOT 1
- "Routes" missing from workers? HOT 1
- Unable to bypass at all. Documentation missing page rules.
- Worker routing problem on react app HOT 2
- nvm
- Preserving Cache Copy if 5xx error or timeout with non-KV. HOT 1
- [Question] How to purge cache once new version of site is released?
- 404 page doesn't render in HTML but plain text HOT 1
- worker-rust example does not work
- Replace `service-worker-mock` w/ Miniflare
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from templates.