Skip to content

Commit 3055079

Browse files
beetlebugorgclaude
andcommitted
chore(deploy): Amplify CSP for the server-tiles app (no wasm)
Custom response headers for the static deploy: a CSP that allows the app's own modules, the OSM basemap, and NOAA connections — without the retired wasm baker's 'wasm-unsafe-eval'/worker-src — plus immutable caching for .pmtiles. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c7eed6b commit 3055079

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

web/customHttp.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# AWS Amplify custom response headers (overrides Amplify's default managed CSP,
2+
# which sets script-src-elem 'none' and blocks the app's own modules).
3+
# Place at the ROOT of the deployed artifact (same dir as index.html). Tiles are
4+
# baked server-side now (no in-browser wasm), so the CSP no longer needs
5+
# 'wasm-unsafe-eval' or worker-src.
6+
customHeaders:
7+
- pattern: '**'
8+
headers:
9+
- key: 'Content-Security-Policy'
10+
value: "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https://tile.openstreetmap.org; media-src 'self' data: blob:; connect-src 'self' blob: data: https://www.charts.noaa.gov https://tile.openstreetmap.org; font-src 'self'; object-src 'none'; base-uri 'self'"
11+
12+
# PMTiles archives: long-lived immutable content (content is versioned by a
13+
# re-bake), and must be byte-range readable — Amplify/CloudFront honour Range
14+
# for these by default; just don't let anything gzip-encode them.
15+
- pattern: '**/*.pmtiles'
16+
headers:
17+
- key: 'Cache-Control'
18+
value: 'public, max-age=31536000, immutable'
19+
- key: 'Content-Type'
20+
value: 'application/octet-stream'

0 commit comments

Comments
 (0)