Skip to content
Dashboard

How we run Vercel's CDN in front of Discourse

DX Engineer

Link to headingVercel as a CDN

vercel.ts
import { type VercelConfig, routes, deploymentEnv } from '@vercel/config/v1'
export const config: VercelConfig = {
rewrites: [
routes.rewrite('/(.*)', deploymentEnv('INNER_HOST'), {
requestHeaders: {
'x-proxy-secret': deploymentEnv('PROXY_HEADER')
}
}),
],
}

The inner host reads the x-proxy-secret header to validate traffic, ensuring that nothing can accesses the inner host directly.

Link to headingRunning multiple apps on a single domain with microfrontends

microfrontends.json
{
"$schema": "https://openapi.vercel.sh/microfrontends.json",
"applications": {
"community-proxy": {
"development": {
"fallback": "community.vercel.com"
}
},
"community-nextjs": {
"routing": [
{
"paths": [
"/.well-known/workflow/:path*",
"/live/:path*"
]
}
]
}
}
}

Link to headingA modern CDN without a massive migration