From 28a93b0fdf5b17d560adc6aef747fd8d5142c4bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Dlouh=C3=BD?= Date: Wed, 30 Sep 2020 14:01:48 +0200 Subject: [PATCH] add installation instruction to README --- cache-bypass-on-cookie/README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cache-bypass-on-cookie/README.md b/cache-bypass-on-cookie/README.md index 7396315..f5c8227 100644 --- a/cache-bypass-on-cookie/README.md +++ b/cache-bypass-on-cookie/README.md @@ -7,4 +7,16 @@ As-configured it is set up for a default WordPress deployment with the default W The worker currently bypasses ALL requests, not just HTML requests. It can be modified to only inspect HTML requests or pretty much any other arbitrary rules for when to bypass the cache. -The worker does not actively manage the cache (extending cache times, purging, etc) = it strictly bypasses any existing caches when the configured rules are matched. \ No newline at end of file +The worker does not actively manage the cache (extending cache times, purging, etc) = it strictly bypasses any existing caches when the configured rules are matched. + + +## INSTALLATION: + +1) Copy content of the cache-bypass-on-cookie.js file to the script section in worker editor. +2) Configure variables at the beginning to fit your needs. +3) Add route to fit URLs where you need to bypass your cache (i.e. `*.example.com/*`) under Workers menu. +4) Add new page rule like `https://*.example.com/*cf_cache_bust*` with `Cache Level: Bypass` before your other caching rules. This is needed if you want your headers to be delivered from server to user when bypassing cache (by both `BYPASS_URL_PATTERNS` and `BYPASS_COOKIE_PREFIXES`) + +### Cache control from server + +If you need more precise control over what will be cached from the server, you can set `cache-cookie=no-cache` or `cache-cookie=cache` cookie to achieve that. Be aware, that if going from cached mode to non-cached mode you will need to go over page listed in `BYPASS_URL_PATTERNS`.