index : paprika

A blogging platform written in Rust for Cloudflare Workers, integrated with Standard Notes

path: root/README.md
diff options
context:
space:
mode:
authorPeter Cai <[email protected]>2020-04-13 18:52:16 +0800
committerPeter Cai <[email protected]>2020-04-13 18:52:16 +0800
commitdaccf6c14271d40808275e3c15ba6a24c89dd492 (patch)
treea24292f247412753e22928044cda1503a5c66d0b /README.md
parent9bd347e1e5a070972703ad8986ccc8e8b2a59308 (diff)
downloadpaprika-daccf6c14271d40808275e3c15ba6a24c89dd492.tar.gz
add support for hard-coded extra proxied resources
Diffstat (limited to 'README.md')
-rw-r--r--README.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/README.md b/README.md
index 5d24c31..3097113 100644
--- a/README.md
+++ b/README.md
@@ -71,6 +71,10 @@ This is the main configuration file. The file will be compiled statically into t
"/foo": "/bar",
...
},
+ "extra_remote_proxy_whitelist": [
+ "<url>",
+ ...
+ ],
"hljs": [
"rust",
"javascript",
@@ -90,6 +94,8 @@ This is the main configuration file. The file will be compiled statically into t
`cache_maxage`: OPTIONAL. A value in seconds determining how long the browser should cache static resources from the blog. If omitted, the default value is a week.
+`extra_remote_proxy_whitelist`: OPTIONAL. See the Remote Resource Proxy section below for details.
+
`hljs`: An array of language support from `highlight.js` to be included in the final binary. The full `highlight.js` is notoriously huge and there's really no reason to include a bazillion languages you will never actually use in your blog posts. This will be read by `build.rs` to generate a JS shim that will load all languages in the array to the final binary via `webpack` support for `require`.
Configuration: theme_config.json
@@ -178,6 +184,23 @@ The execution context of each template is defined in `src/render.rs`, as those `
The theme directory selected via `config.json` will be included into the final binary. Therefore, please make sure your assets are not too huge to fit in the 1MB binary limit of Cloudflare Worker.
+Remote Resource Proxy
+===
+
+Paprika replaces all external images inserted into your posts by Markdown with a proxied version hosted on the same URL of your blog under the `/imgcache/` path. This ensures that the source websites cannot see your visitors' IP addresses and that the Cloudflare CDN policy can be applied to them to ensure faster loading time.
+
+The cached URL is formatted like below:
+
+```
+https://<your_domain>/imgcache/<origin_url_urlencoded>
+```
+
+where `origin_url_urlencoded` is the URL-encoded version (as per JavaScript `encodeURIComponent` function) of the URL to the original resource. A whitelist of origin URLs is maintained in Workers KV so that this URL cannot be used on arbitrary content -- only those that are present in your published posts will be reverse-proxied. The whitelist is updated every time a post is re-rendered -- that is, when you create / update a post or update the Paprika program or its other resources.
+
+You can hard-code more whitelisted URLs (non-URL-encoded version) in the `extra_remote_proxy_whitelist` array of `config.json`. This may be useful if your theme supports things like avatars, where custom URLs need to be provided (which is the case with the default theme).
+
+The reverse-proxy only forwards the `Content-Type` header and the actual body of the response (of course, after the body is decoded properly and cached by Cloudflare's Fetch API). It also follows 30x redirects by default. Other fields will be re-calculated by the runtime before returning to the client.
+
FAQs
===