Skip to content

Commit

Permalink
add installation instruction to README
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Sep 30, 2020
1 parent 8aca0a6 commit 28a93b0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cache-bypass-on-cookie/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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`.

0 comments on commit 28a93b0

Please sign in to comment.