-
Notifications
You must be signed in to change notification settings - Fork 217
Expand file tree
/
Copy pathsws.toml
More file actions
80 lines (71 loc) · 3.31 KB
/
Copy pathsws.toml
File metadata and controls
80 lines (71 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Caching contract for the self-hosted Docker image (static-web-server).
#
# This file is the Docker twin of public/_headers: the Cloudflare Pages
# deployment gets its cache rules from _headers, which static-web-server does
# not read. Without it the server falls back to its extension-based defaults --
# `max-age=86400` for HTML and `max-age=31536000` for every .js/.css -- and the
# stable-named files then outlive the image they came from. A self-hoster who
# pulls a new image keeps serving the previous editor.html (and with it the
# previous hashed bundle) out of the browser cache for a day, and the previous
# vendor JS for a year, which is how a fix that shipped weeks ago can still be
# missing from a freshly pulled container (GitHub #144).
#
# Rules are applied in order and merged per header, so the catch-all below sets
# the safe default and the specific rules that follow relax it.
[advanced]
# Default: revalidate. Same semantics as the Pages default, and what every
# stable-named file needs -- HTML, sw.js, the deploy-coupled shell files
# (home.css, landing.css, lang-switch.js, sw-register.js, open-local.js,
# landing-prefetch.js, ranui-iife/) and the vendor trees,
# whose JS carries our own runtime patch (x2t_helper.js). Revalidation is a
# conditional request answered with 304, not a re-download.
[[advanced.headers]]
source = "**"
[advanced.headers.headers]
Cache-Control = "no-cache"
# Keep the vendored editor trees out of search indexes (mirrors _headers).
[[advanced.headers]]
source = "/sdkjs/**"
[advanced.headers.headers]
X-Robots-Tag = "noindex"
[[advanced.headers]]
source = "/web-apps/**"
[advanced.headers.headers]
X-Robots-Tag = "noindex"
# Hashed build outputs: the filename changes with the content.
[[advanced.headers]]
source = "/assets/**"
[advanced.headers.headers]
Cache-Control = "public, max-age=31536000, immutable"
# Fingerprinted by bin/build.sh, same reasoning.
[[advanced.headers]]
source = "/ran-tokens.*.css"
[advanced.headers.headers]
Cache-Control = "public, max-age=31536000, immutable"
# Self-hosted webfonts: unhashed, but they only change with a ranui release.
[[advanced.headers]]
source = "/ran-fonts/**"
[advanced.headers.headers]
Cache-Control = "public, max-age=604800, must-revalidate"
# The editor's indexed font catalog (000..266, 2 KB - 16 MB each): replaced
# only together with the vendor build, and revalidating them per open is what
# put a CJK deck on "Loading presentation" for minutes on production.
# Content-Type mirrors _headers -- these have no extension, so without it the
# server types them application/octet-stream and skips compression on files
# that gzip to roughly half. The bytes are an XOR-prefixed TTF consumed via
# XHR arraybuffer, so the label is for transport only (see public/_headers).
[[advanced.headers]]
source = "/fonts/*"
[advanced.headers.headers]
Cache-Control = "public, max-age=31536000, immutable"
Content-Type = "font/ttf"
X-Robots-Tag = "noindex"
# The x2t WASM: the single largest download, vendor-versioned. The file holds
# brotli bytes; Content-Encoding is what makes the browser decode them (see the
# same rule in public/_headers). Without it the editor gets an opaque blob and
# never loads.
[[advanced.headers]]
source = "/sdkjs/common/wasm/x2t/x2t.wasm.br"
[advanced.headers.headers]
Content-Encoding = "br"
Cache-Control = "public, max-age=31536000, immutable"