How we run Vercel's CDN in front of Discourse
By Steven Van ·
Vercel details how it proxies its own Discourse-based community forum through its CDN for analytics, firewall, and bot protection.
Vercel's CDN can sit in front of any application, not just projects deployed natively on the platform, and the company uses this pattern to run Vercel's own community forum. The Vercel Community is a Discourse app hosted elsewhere, proxied through Vercel's CDN, which protects it and adds features from Vercel's website stack.
- Web Analytics gives anonymized, cookie-free demographic and referrer data on visitors.
- Firewall provides DDoS protection and has automatically prevented several attacks over the past year.
- Bot Management blocks malicious scrapers while letting trusted crawlers index the forum, including for ChatGPT search.
Some parts of the community site, like its live sessions, run directly on Vercel with Next.js. Vercel uses Microfrontends to mount a Next.js app on the same domain as the Discourse app, to add pages that would be hard to build as Discourse plugins, override existing Discourse pages, and keep users signed in through Sign in with Vercel.
To set this up, a site needs two domains: an inner host, the actual origin server, and an outer host, the Vercel project domain that users interact with. Traffic is rewritten from the outer host to the inner host through a vercel.ts config, and a separate microfrontends.json file can route specific paths, such as live sessions or workflow events, to their own Vercel projects. The full setup is described in Vercel's writeup.
