Files
longhikes/web/static/_headers
T
swaitsandClaude Fable 5.2 f2d3b71810
Mirror to forge / mirror (push) Canceled after 0s
Validate / validate (push) Canceled after 0s
Validate / history (push) Canceled after 0s
Validate / site (push) Canceled after 0s
Validate / deploy (push) Canceled after 0s
Add 130 views of the same records, speed up map pages, and say who maintains the site
- New pages built from the records: lists by length, time to walk,
  month, kind of walking and holder; place-by-list pages; a Triple Crown
  table and key-figure tables for the National Scenic and Recreation
  Trails; highest points, most climbing and climb per mile; a page for
  every route author, with the authors of three or more routes leading
  the authors page; connected trails; recently added and changed; a
  glossary and a method page. Every place page opens with a summary.
- Trail pages open with an "In brief" paragraph generated from the
  record and show when the record was last checked. The About page says
  who maintains the site and how to reach them.
- The map starts when it is reached, not with the page. The site's own
  CSS, scripts and fonts are fingerprinted and cached for a year. Every
  image has its dimensions.
- Titles are held to 60 characters and share previews get their own
  shorter description.
- Social cards are redrawn so a long name can no longer push text into
  the footer, and the site-wide card takes its wording from the site
  settings instead of an old hand-made image.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 16:51:13 -07:00

132 lines
5.5 KiB
Plaintext

# Netlify response headers. web/build.py copies web/static/ verbatim into the
# publish root, so this file is deployed as _site/_headers.
#
# Syntax and wildcard rules (checked 2026-11-10):
# https://docs.netlify.com/manage/routing/headers/
# Wildcards (*) are allowed anywhere inside a path segment ("*.gpx" is valid)
# and match any characters; every rule whose path matches a request applies.
# Trail downloads live at /trails/<id>/<name>, one directory below /trails/,
# so both segments are matched explicitly rather than relying on * to span the
# slash.
#
# No two rules set the same header for the same path: when rules overlap,
# Netlify applies all of them, so each header is set by one rule only
# (web/tests/test_headers.py checks this against the built site).
# Security headers for every response. No inline scripts or style elements:
# pages load same-origin scripts and styles, MapLibre and the contour add-on
# run from blob: workers, map images are self/data:/blob:, fonts are
# self-hosted, and tiles, glyphs and sprites are fetched from OpenFreeMap
# (connect-src). The trail maps' relief and contours fetch elevation tiles
# (Terrain Tiles on AWS) with fetch(), from the page or the add-on's worker,
# which keeps this policy: connect-src allows that one path only, not all of
# s3.amazonaws.com. style-src-attr allows style="" attributes, which the
# pages use only to carry data to CSS (--km for the length strip, --n for the
# ratio bar, --pos for the verification gauge).
/*
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self'; style-src-attr 'unsafe-inline'; worker-src 'self' blob:; child-src 'self' blob:; img-src 'self' data: blob:; font-src 'self'; connect-src 'self' https://tiles.openfreemap.org https://s3.amazonaws.com/elevation-tiles-prod/terrarium/; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'
# Site data. Matched by file type, not /data/*, so the pages under /data/
# (/data/, /data/schema/, /data/changelog/) revalidate like every other page.
# overview.geojson and trails.json are fetched by page scripts; index.geojson,
# trails.csv and the two archives are downloads.
/data/*.json
Cache-Control: public, max-age=300, must-revalidate
/data/*.geojson
Cache-Control: public, max-age=300, must-revalidate
/data/*.csv
Cache-Control: public, max-age=300, must-revalidate
/data/*.zip
Content-Type: application/zip
Content-Disposition: attachment
Cache-Control: public, max-age=300, must-revalidate
/data/overview.geojson
Content-Type: application/geo+json
/data/trails.json
Content-Type: application/json
/data/index.geojson
Content-Type: application/geo+json
Content-Disposition: attachment
/data/trails.csv
Content-Type: text/csv; charset=utf-8
Content-Disposition: attachment
# HTML revalidates before reuse. Netlify's default for static assets is already
# "public, max-age=0, must-revalidate" (which also covers clean URLs served
# from index.html); this makes the intent explicit for .html requests.
/*.html
Cache-Control: public, max-age=0, must-revalidate
# The site's stylesheet, scripts, fonts and the map libraries are named for a hash
# of their content and served from /immutable/ (web/olt/fingerprint.py writes them
# there at build time, and every page names them by the hashed address), so a file
# never changes under its name: cache it for a year and never ask again. The rule
# is by directory, not by file type, so it cannot reach a file that is not hashed.
/immutable/*
Cache-Control: public, max-age=31536000, immutable
# What stays under /assets/ (the icons, the social card, the base-map style, the
# licence texts) keeps its address, so it revalidates.
/assets/*
Cache-Control: public, max-age=300, must-revalidate
# Raw files under /trails/ are kept out of search results with X-Robots-Tag:
# noindex, so that a trail's page stays the one result for its name, its length
# or its GPX, and a 29 MB GeoJSON or a TOML record is not offered beside it.
# The files stay fetchable and linked. The bulk downloads under /data/ are the
# dataset's own distribution (the Dataset markup on /data/ names them) and are
# left indexable, as is the feed and llms.txt. Each header is set by one rule only.
# Trail downloads: correct media types and a download disposition.
/trails/*/*.gpx
Content-Type: application/gpx+xml
Content-Disposition: attachment
Cache-Control: public, max-age=3600
X-Robots-Tag: noindex
/trails/*/*.geojson
Content-Type: application/geo+json
Content-Disposition: attachment
Cache-Control: public, max-age=3600
X-Robots-Tag: noindex
# Map geometry for the trail pages: fetched by page scripts, never a download.
/trails/*/map.json
Content-Type: application/json
Cache-Control: public, max-age=300, must-revalidate
X-Robots-Tag: noindex
# Where a trail has no track, the page sketches its ends from this file.
/trails/*/sketch.json
X-Robots-Tag: noindex
# Record and release notes: shown in the browser, not downloaded.
/trails/*/trail.toml
Content-Type: text/plain; charset=utf-8
X-Robots-Tag: noindex
/trails/*/release.txt
Content-Type: text/plain; charset=utf-8
X-Robots-Tag: noindex
# The Atom feed of the changelog, and the plain-text guide for assistants.
/feed.xml
Content-Type: application/atom+xml; charset=utf-8
Cache-Control: public, max-age=3600, must-revalidate
/llms.txt
Content-Type: text/plain; charset=utf-8
# Licence texts (LICENSE has no extension): shown in the browser as text.
/licences/*
Content-Type: text/plain; charset=utf-8