-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_headers
More file actions
217 lines (172 loc) · 7.92 KB
/
Copy path_headers
File metadata and controls
217 lines (172 loc) · 7.92 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# Cloudflare Pages custom headers
# https://developers.cloudflare.com/pages/configuration/headers/
# HTML — always revalidate (ensures users get latest version)
/index.html
Cache-Control: public, max-age=0, must-revalidate
/pages/*
Cache-Control: public, max-age=0, must-revalidate
# Isolated MapLibre/vector-tile rewrite lab. Keep out of search results and
# avoid stale HTML/service-worker files while it is under active development.
/render/
Cache-Control: public, max-age=0, must-revalidate
X-Robots-Tag: noindex, nofollow
/render/index.html
Cache-Control: public, max-age=0, must-revalidate
X-Robots-Tag: noindex, nofollow
/render/sw.js
Cache-Control: public, max-age=0, must-revalidate
Service-Worker-Allowed: /render/
X-Robots-Tag: noindex, nofollow
/render/build/*
Cache-Control: public, max-age=31536000, immutable
X-Robots-Tag: noindex, nofollow
/render/tiles/*
Cache-Control: public, max-age=31536000, immutable
X-Robots-Tag: noindex, nofollow
# Temporary compatibility route for pre-promotion /test2 links. Runtime assets
# now live under /app and root /index.html is the production MapLibre shell.
/test2/
Cache-Control: public, max-age=0, must-revalidate
X-Robots-Tag: noindex, nofollow
/test2/index.html
Cache-Control: public, max-age=0, must-revalidate
X-Robots-Tag: noindex, nofollow
/test2/sw.js
Cache-Control: public, max-age=0, must-revalidate
Service-Worker-Allowed: /test2/
X-Robots-Tag: noindex, nofollow
/app/build/app.bundle.js
Cache-Control: no-cache, must-revalidate
/app/build/app.bundle.css
Cache-Control: no-cache, must-revalidate
# Content-hashed, so the filename changes whenever the contents do and a long
# immutable TTL is safe. Stating it explicitly rather than inheriting the default
# also keeps these on the same footing as /render/build/*, which has always had it.
/app/build/chunks/*.js
Cache-Control: public, max-age=31536000, immutable
/app/build/*.map
Cache-Control: no-cache, must-revalidate
/app/build/chunks/*.map
Cache-Control: no-cache, must-revalidate
/app/build/performance-dashboard.json
Cache-Control: no-cache, must-revalidate
/app/build/mobile-performance-report.json
Cache-Control: no-cache, must-revalidate
/app/build/chunks/*
Cache-Control: public, max-age=31536000, immutable
/app/src/*
Cache-Control: no-cache, must-revalidate
# Safe ONLY because every request for these carries ?v=<content hash of the file>,
# injected at build time (build-test2-app.mjs -> __VIEWER_ASSET_VERSIONS__, and the
# stamped links in maps/index.html). With fixed tokens the edge served a stages2.js hours
# old and a stages.css 43 days old after deploys had changed both.
/app/js/*
Cache-Control: public, max-age=31536000, immutable
/app/election-viewer-package/*
Cache-Control: public, max-age=31536000, immutable
/render/metadata/maps-test-index.json
# Safe ONLY because the client requests this with ?v=<content hash of the
# file>, injected at build time (build-test2-app.mjs -> __METADATA_INDEX_VERSION__).
# If that token ever goes back to a hand-edited constant, revert this to
# max-age=0, must-revalidate -- an immutable stale catalogue cannot be undone
# from the server side.
Cache-Control: public, max-age=31536000, immutable
X-Robots-Tag: noindex, nofollow
/render/metadata/layer-details-test2/*
Cache-Control: public, max-age=86400, stale-while-revalidate=604800
X-Robots-Tag: noindex, nofollow
/render/metadata/duplicate-feature-ids/*
Cache-Control: public, max-age=86400, stale-while-revalidate=604800
X-Robots-Tag: noindex, nofollow
/render/metadata/elections-test2-summaries/*
Cache-Control: public, max-age=86400, stale-while-revalidate=604800
X-Robots-Tag: noindex, nofollow
# Service worker — must revalidate on every load so deploys propagate to all
# clients within one navigation. The SW itself caches downstream resources;
# its own file should never be cached aggressively or we can't ship fixes.
/sw.js
Cache-Control: no-cache, must-revalidate
Service-Worker-Allowed: /
# Entry bundles are not filename-fingerprinted. They carry content-derived query
# versions, but must still revalidate so a reused URL cannot strand clients on
# stale dynamic imports.
/build/app.bundle.js
Cache-Control: no-cache, must-revalidate
/build/app.bundle.js.map
Cache-Control: no-cache, must-revalidate
/build/main.css
Cache-Control: no-cache, must-revalidate
/build/main.critical.css
Cache-Control: no-cache, must-revalidate
/build/about.css
Cache-Control: no-cache, must-revalidate
# Hashed dynamic JS chunks can cache forever. Keep this scoped below
# /build/chunks/ so stable root entry assets above do not inherit immutable
# caching.
/build/chunks/*
Cache-Control: public, max-age=31536000, immutable
# Fonts — never change, cache forever
/assets/fonts/*
Cache-Control: public, max-age=31536000, immutable
# Leaflet CSS + images — versioned in filename, cache forever
/assets/css/leaflet-*
Cache-Control: public, max-age=31536000, immutable
/assets/css/images/*
Cache-Control: public, max-age=31536000, immutable
# Map data (FGB files) — immutable once deployed
/data/maps/*
Cache-Control: public, max-age=31536000, immutable
# Thumbnails — content stable but not fingerprinted. 30 days + stale-while-revalidate
# so repeat visitors don't refetch ~5 MB of PNGs every 4 hours. Append ?v=N to the
# <img src> in ui-controller.js if a thumbnail's content changes.
/assets/thumbnails/*
Cache-Control: public, max-age=2592000, stale-while-revalidate=86400
# Spatial index chunks — cache for 1 week
/data/database/spatial-index/*
Cache-Control: public, max-age=604800
# Maps database — must revalidate every load. The previous policy
# (max-age=300, stale-while-revalidate=86400) silently held stale
# copies for up to 24 h after a deploy, hiding newly added catalogue
# entries even after Ctrl+Shift+R. With must-revalidate the browser
# sends If-None-Match each load and the CDN responds 304 (cheap)
# unless the file actually changed.
/data/database/maps.json
Cache-Control: public, max-age=0, must-revalidate
/data/database/data-entries.json
Cache-Control: public, max-age=0, must-revalidate
/data/database/books.json
Cache-Control: public, max-age=0, must-revalidate
/data/database/geographies.json
Cache-Control: public, max-age=0, must-revalidate
# Spatial index monolithic — fallback, cache for 1 day
/data/database/spatial-index.json
Cache-Control: public, max-age=86400
# Election data — rarely changes
/data/elections-source/data/*
Cache-Control: public, max-age=604800
# ------------------------------------------------------------------------------
# Security headers (UX plan T3-02, finding #20)
#
# This file existed but carried CACHE rules only -- not one security directive.
#
# The CSP is deliberately permissive about scripts because the app is not currently
# built for a strict one: the shell uses inline handlers and inline <style>, and
# tightening those is a separate piece of work that would break the site if done
# blind. What is here is the part that can be turned on WITHOUT a rewrite, and it
# still closes the two things that matter most -- framing and transport.
#
# frame-ancestors 'none' clickjacking. Also sent as X-Frame-Options for older agents.
# object-src 'none' no plugin content, ever.
# base-uri 'self' stops an injected <base> retargeting every relative URL.
# form-action 'self' an injected form cannot post credentials off-site.
# upgrade-insecure-requests no mixed content.
#
# NOT set: default-src/script-src. Adding those before the inline handlers are
# removed would break the map on the first request, and a CSP that has to be
# reverted teaches everyone to distrust the file.
/*
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Security-Policy: frame-ancestors 'none'; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests