# Cloudflare Pages response headers. Pages-only — the Vite dev server ignores this file.
#
# Apple fetches /apple-app-site-association with no extension; the Universal Links
# spec asks for application/pbinfo+json. Android's verifier wants plain JSON.
/apple-app-site-association
  Content-Type: application/pbinfo+json
/.well-known/assetlinks.json
  Content-Type: application/json

# Installable PWA (§AV). The manifest and icons are same-origin, so the CSP below
# needs nothing extra: manifest-src falls back to default-src 'self', icons are
# img-src 'self'. They aren't content-hashed, so cache them briefly; sw.js is
# always revalidated so a new worker ships with the next deploy.
/manifest.webmanifest
  Content-Type: application/manifest+json
  Cache-Control: public, max-age=3600
/icons/*
  Cache-Control: public, max-age=86400
/apple-touch-icon.png
  Cache-Control: public, max-age=86400
/sw.js
  Cache-Control: no-cache

# Security headers for the whole SPA (every route, including the public
# overlay/hub/play/enter pages, is the same index.html).
#
# The CSP is static, so it names the production origins: api.ramphearth.com
# (VITE_API_BASE; https for fetch, wss for /ws) and livekit.ramphearth.com
# (LIVEKIT_WS_URL; wss signalling, https for its /rtc/validate fallback).
# Changing either hostname means changing it here too. TURN is not listed:
# ICE traffic is not governed by CSP.
#
# Directive notes — each loosening has a reason:
#  script-src     no inline scripts in index.html. 'wasm-unsafe-eval'
#                 is RNNoise noise suppression (WebAssembly.compile), NOT eval.
#                 Excalidraw's export font-subsetter uses new Function(); that is
#                 deliberately not allowed — on failure Excalidraw logs "Skipped
#                 glyph subsetting" and embeds the whole font (bigger export).
#  style-src      'unsafe-inline' is unavoidable: React style={{}} props, Tiptap
#                 and Excalidraw all set inline styles.
#  img-src        no blanket https: (§AN). Attachments, avatars and org icons
#                 come from the API; every third-party image (link previews,
#                 custom emoji/stickers, GIFs, card banners, overlay alert
#                 images) goes through the API's signed /media/proxy, so the
#                 viewer's browser never contacts the third party. data:/blob:
#                 are QR codes, Excalidraw images and avatar crops.
#  media-src      attachments, floor music and overlay sounds use signed API URLs.
#                 No arbitrary https audio (§CQ). LiveKit uses srcObject streams.
#  font-src       same-origin only: all Excalidraw fonts are copied at build
#                 time, and its CDN fallback is rewritten to our own origin.
#  connect-src   no GIF provider: GIF search runs on the API since §AN, so the
#                 browser never talks to Giphy (key and viewer IP stay with us).
#  worker-src blob: Excalidraw's image resizer (pica) spawns blob: workers;
#                 sw.js and the audio worklets are same-origin ('self'). pica
#                 also probes OffscreenCanvas with a data: worker; that is
#                 refused (one console report) and it falls back cleanly.
#  frame-src      Excalidraw whiteboard embeds (Vimeo/Figma). Tweet/Reddit/Gist
#                 embeds need third-party scripts and stay blocked. YouTube,
#                 Spotify and SoundCloud players were removed (owner decision 77,
#                 Oct 31): no provider frames or scripts, and whiteboards refuse
#                 YouTube embeds (whiteboard/excalidraw.ts validateEmbeddable).
#  apis.google.com / docs.google.com  Google's file Picker for My files (owner
#                 decision G2, docs/MOVE_AND_CLOUD_FILES_PLAN.md): its loader script
#                 and its chooser frame, loaded only when a person presses "Add files
#                 from Google Drive" (lib/googlePicker.ts). Nothing else from Google.
#  embed.ramphearth.com  a client portal's embedded tools (docs/PORTAL_EMBEDS_PLAN.md).
#                 Never the tools' own origins: the app frames only our frame page on
#                 its own host, and that page's CSP (set per answer by the API) names
#                 the one address a firm embedded. Nothing loads until a contact
#                 presses Load. Self-hosted: the proxy adds PORTAL_EMBED_URL's origin.
#  frame-ancestors 'none': OBS loads the overlay URL directly, not in a frame.
/*
  Content-Security-Policy: default-src 'self'; script-src 'self' 'wasm-unsafe-eval' https://apis.google.com; style-src 'self' 'unsafe-inline'; img-src 'self' https://api.ramphearth.com data: blob:; media-src 'self' https://api.ramphearth.com data: blob:; font-src 'self' data:; connect-src 'self' https://api.ramphearth.com wss://api.ramphearth.com https://livekit.ramphearth.com wss://livekit.ramphearth.com; worker-src 'self' blob:; frame-src https://player.vimeo.com https://www.figma.com https://docs.google.com https://embed.ramphearth.com; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'
  Strict-Transport-Security: max-age=31536000; includeSubDomains
  X-Content-Type-Options: nosniff
  Referrer-Policy: strict-origin-when-cross-origin
  X-Frame-Options: DENY
  Permissions-Policy: microphone=(self), camera=(self), display-capture=(self), fullscreen=(self), autoplay=(self), geolocation=(), payment=(), usb=(), serial=(), hid=(), bluetooth=(), midi=(), magnetometer=(), gyroscope=(), accelerometer=(), browsing-topics=()

# The public booking page on the app origin (§EI, docs/BOOKING_LINKS_PLAN.md §3), used until book.ramphearth.com is
# set up: /book/* is book-app.html (public/_redirects). It is opened by anyone on the internet, so it drops the app's
# policy (`! Content-Security-Policy` detaches the header the /* rule set) for the booking page's own strict one —
# no wasm, workers, media, frames or LiveKit; 'self' + the API for its calls — and turns the mic and camera off.
# Keep in step with public-booking/_headers.
/book/*
  ! Content-Security-Policy
  ! Permissions-Policy
  Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' https://api.ramphearth.com data: blob:; connect-src 'self' https://api.ramphearth.com; font-src 'self' data:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'
  Permissions-Policy: microphone=(), camera=(), display-capture=(), fullscreen=(self), autoplay=(), geolocation=(), payment=(), usb=(), serial=(), hid=(), bluetooth=(), midi=(), magnetometer=(), gyroscope=(), accelerometer=(), browsing-topics=()
  X-Robots-Tag: noindex

# The public ticket site on the app origin (§FB T4, docs/TICKETS_PLAN.md §4.3), used while TICKETS_PUBLIC_URL is blank:
# /help/* is tickets-app.html (public/_redirects). Like /book/*, it drops the app's policy for the site's own strict one
# (a same-origin worker for the proof of work; no media, frames or LiveKit) and keeps frame-ancestors 'none' — the
# embeddable form lives only on tickets.ramphearth.com. Keep in step with public-tickets/_headers.
/help/*
  ! Content-Security-Policy
  ! Permissions-Policy
  Content-Security-Policy: default-src 'self'; script-src 'self'; worker-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' https://api.ramphearth.com data: blob:; connect-src 'self' https://api.ramphearth.com; font-src 'self' data:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'
  Permissions-Policy: microphone=(), camera=(), display-capture=(), fullscreen=(self), autoplay=(), geolocation=(), payment=(), usb=(), serial=(), hid=(), bluetooth=(), midi=(), magnetometer=(), gyroscope=(), accelerometer=(), browsing-topics=()
  X-Robots-Tag: noindex


# The website chat box on the app origin (docs/ENGAGE_PLAN.md Part 2), used while ENGAGE_PUBLIC_URL is blank: /engage/*
# is engage-app.html (public/_redirects). Its own strict policy like /help/*, and frame-ancestors 'none': the app origin
# is never framed, so there the snippet's button opens the chat in a small window. Keep in step with public-engage/_headers.
/engage/*
  ! Content-Security-Policy
  ! Permissions-Policy
  Content-Security-Policy: default-src 'self'; script-src 'self'; worker-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' https://api.ramphearth.com data: blob:; connect-src 'self' https://api.ramphearth.com; font-src 'self' data:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'
  Permissions-Policy: microphone=(), camera=(), display-capture=(), fullscreen=(self), autoplay=(), geolocation=(), payment=(), usb=(), serial=(), hid=(), bluetooth=(), midi=(), magnetometer=(), gyroscope=(), accelerometer=(), browsing-topics=()
  X-Robots-Tag: noindex
# The chat snippet's script on the app origin (a copy of public-engage/embed.js), loaded by workspaces' websites.
/engage-embed.js
  Cache-Control: public, max-age=300