netlify/edge-functions/README.md
This directory contains edge functions for the nx-dev Next.js application (nx-dev/nx-dev/).
Edge functions must be placed here (at the repository root) because of how the nx-dev Netlify site is configured:
. (repository root)./nx-dev/nx-dev/.nextNetlify auto-discovers edge functions from netlify/edge-functions/ relative to the base directory. Since the base directory is the repo root, edge functions must be placed here rather than inside nx-dev/nx-dev/.
We attempted to configure a custom path via edge_functions = "nx-dev/nx-dev/netlify/edge-functions" in netlify.toml, but this was not recognized by Netlify's build system.
rewrite-framer-urls.tsProxies all requests to Framer by default and rewrites URLs in the HTML response to use nx.dev instead of the Framer domain. Only paths explicitly kept in Next.js (defined in the nextjsPaths set and excludedPath config) bypass the proxy.
This ensures:
Environment variables (configured in Netlify):
NEXT_PUBLIC_FRAMER_URL: The Framer site URL (e.g., https://ready-knowledge-238309.framer.app)additional-sitemaps.tsProxies the per-source sitemaps referenced by the root sitemap index and rewrites URLs to use nx.dev. Separate from the main Framer/blog proxy so that proxy can keep accept: ['text/html'] for compute cost savings.
| Path | Upstream | Env var |
|---|---|---|
/sitemap-1.xml | <NEXT_PUBLIC_FRAMER_URL>/sitemap.xml | NEXT_PUBLIC_FRAMER_URL |
/sitemap-2.xml | <BLOG_URL>/blog/sitemap.xml | BLOG_URL |
The root sitemap index references these via scripts/patch-sitemap-index.mjs (additionalSitemaps list).
This directory can be removed once the nx-dev Next.js application is retired and all pages are served from the Astro-based documentation site.