Use Next.js middleware for CSP so frame-ancestors works at runtime

Fixkamo-analytics
Shipped
April 17, 2026 at 7:11 PM UTC
Author
Kamo
Commit
da342fc

The standalone build bakes next.config.ts headers at build time, so ALLOWED_FRAME_URLS was always empty. Move CSP to a Next.js middleware that reads the env var at request time. This allows analytics to be embedded in iframes from kamo-internal without needing build-time env vars.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing