You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-12Lines changed: 14 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -61,10 +61,11 @@ included as a part of [Handler](./workers/handler/) in order to ensure that the
61
61
[Watcher](./workers/watcher/).
62
62
63
63
The [worker](https://developers.cloudflare.com/workers/) also exposes a `/purge` endpoint that allows tags to be purged.
64
-
This endpoint matches the [interface of the Cloudflare endpoint](https://developers.cloudflare.com/api/operations/zone-purge#purge-cached-content-by-tag-host-or-prefix), but only allows `tags`. If no
65
-
[zone](https://developers.cloudflare.com/fundamentals/setup/accounts-and-zones/#zones) information is provided
66
-
(via the [CF-Worker](https://developers.cloudflare.com/fundamentals/reference/http-request-headers/#cf-worker) header),
67
-
matching resources from **all** zones will be purged.
64
+
This endpoint matches the
65
+
[interface of the Cloudflare endpoint](https://developers.cloudflare.com/api/operations/zone-purge#purge-cached-content-by-tag-host-or-prefix), but only allows `tags`. If no
66
+
[zone](https://developers.cloudflare.com/fundamentals/setup/accounts-and-zones/#zones) information is provided (via the
After receiving and validating requests to either the `/capture` or `/purge` endpoints, the
70
71
[worker](https://developers.cloudflare.com/workers/) adds the requests to the `cache-capture` and `cache-purge-tag`
@@ -80,26 +81,27 @@ tags are stored in the [D1](https://developers.cloudflare.com/d1/) database.
80
81
A message received from [Controller](./workers/controller/) in the `cache-purge-tag` queue results in the URLs being
81
82
looked up in the [D1](https://developers.cloudflare.com/d1/) database from the provided tag, and re-queing those URLs by
82
83
adding each one to the `cache-purge-url` queue. Since this will result in the resource being eventually removed from the
83
-
cache, the URL and all tags associated with it are removed from the [D1](https://developers.cloudflare.com/d1/) database.
84
+
cache, the URL and all tags associated with it are removed from the [D1](https://developers.cloudflare.com/d1/)
85
+
database.
84
86
85
87
Finally, when a message is received from the `cache-purge-url` queue, the URLs are
86
88
[purged with Cloudflare's API](https://developers.cloudflare.com/api/operations/zone-purge#purge-cached-content-by-url).
87
89
88
90
## Usage
89
91
90
92
I am not aware of a good way to distribute this application for use on your own other than forking it and modifying it.
91
-
It is [licensed under the AGPL-3.0 license](./LICENSE.md) so you are free to modify it under the temrs of that license.
92
-
I thought about using Terraform in order to make it easier for others to deploy on their own, but it seemed like
93
-
overkill for my purposes. I'm happy to accept PRs that make life easier.
93
+
It is [licensed under the AGPL-3.0 license](./LICENSE.md) so you are free to modify it under the terms of that license.
94
+
I thought about using [Terraform](https://www.terraform.io/) in order to make it easier for others to deploy on their
95
+
own, but it seemed like overkill for my purposes. I'm happy to accept PRs that make life easier.
94
96
95
97
## Authentication
96
98
97
99
I chose to use the `API_TOKEN`[secret](https://developers.cloudflare.com/workers/configuration/secrets/) for
98
100
authentication/authorization to the [Controller](./workers/controller/) and to use the same token to make requests to
99
-
the [Cloudflare API](https://developers.cloudflare.com/api/). This simplified the approach by only having to have a single secret in the worker and sharing that
100
-
secret with the Origin server. This allows the origin to make requests to the
101
-
[Cloudflare API](https://developers.cloudflare.com/api/) or the[Worker](https://developers.cloudflare.com/workers/)
102
-
seamlessly.
101
+
the [Cloudflare API](https://developers.cloudflare.com/api/). This simplified the approach by only having to have a
102
+
single secret in the worker and sharing that secret with the Origin server. This allows the origin to make requests to
103
+
the [Cloudflare API](https://developers.cloudflare.com/api/) or the
0 commit comments