* fix(org): serve OG images from CDN for Discord embeds Discord times out on slow dynamic OG generation (~3-5s). Persist generated images to R2, point meta tags at the media CDN, and warm the API endpoint on org-site page loads so crawlers get a fast static PNG URL. Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> * docs: add org-site Open Graph and favicon guides Document user-facing sharing behavior and contributor architecture for dynamic OG images, favicon fallback, R2/CDN caching, and embed cache invalidation. Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> * fix(org-site): address PR review on OG CDN fallback and docs - Fall back to API OG URL when CDN object is not yet available (HEAD check) - Cancel warm-fetch response body to avoid connection pool exhaustion - Align tenant-router OG edge cache TTL with one-hour API revalidation - Fix favicon docs navigation and add Custom Domain tab screenshot - Replace Chiberry Artistry example with AI Academy Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> * fix(org-site): accept docker hostnames for OG warm URL Use isValidHttpUrl for PRIVATE_SERVER_URL so internal values like http://api:3081 work for SSR warm fetches in Docker Compose. Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>
@cio/tenant-router
Cloudflare Worker that fronts every browser-facing ClassroomIO host:
*.myclassroomio.com/*— free-tier tenant sitesmyclassroomio.com/*— apex (301 →classroomio.com)app.classroomio.com/*— admin dashboardembed.classroomio.com/*— public embed widget scripts (R2assetsbucket, path-for-path)- BYOD customer domains via Approximated (their proxy forwards to
cio-api.onrender.comdirectly, not through this Worker)
The Worker forwards each request to one of two Render services based on path:
| Host / path | Upstream |
|---|---|
embed.* |
R2 assets bucket — /{widget} maps to internal keys (src/embed-assets.ts) |
/proxy/* |
API service (/proxy prefix stripped, rest forwarded as-is) |
| anything else | Dashboard service |
The /proxy prefix is the same-origin escape hatch the dashboard's
browser code uses so its auth cookies stay host-only while still reaching
the API. Example: a browser request to
https://app.classroomio.com/proxy/api/auth/sign-in/email becomes
/api/auth/sign-in/email on the API service (where Better Auth lives).
It preserves the original host as X-Forwarded-Host so:
- The dashboard's SvelteKit adapter-node reads it via
HOST_HEADER=x-forwarded-hostandevent.url.hostbecomes the tenant/admin/BYOD host. - Better Auth on the API emits session cookies without a
Domainattribute (seepackages/db/src/auth.ts—crossSubDomainCookies: { enabled: false }), so the browser scopes each session to the exact host it called. Tenants onacme.myclassroomio.com, the admin app onapp.classroomio.com, and BYODlearn.acme.comeach get host-only sessions.
Deploy
pnpm --filter @cio/tenant-router deploy
Live tail:
pnpm --filter @cio/tenant-router tail
Env vars (wrangler.toml [vars])
| Var | Value |
|---|---|
DASHBOARD_UPSTREAM_HOST |
.onrender.com host of the dashboard service (no scheme) |
API_UPSTREAM_HOST |
.onrender.com host of the API service |
APEX_REDIRECT_TARGET |
URL to redirect myclassroomio.com apex to (default https://classroomio.com) |
EMBED_HOST |
Hostname for public embed widgets (default embed.classroomio.com) |
API_URL |
API origin injected into embed scripts as window.CIO.apiBaseUrl |
Update the values in wrangler.toml after looking them up in the Render dashboard.
Cloudflare DNS expected setup
myclassroomio.com zone:
*CNAME → any valid target, Proxied@CNAME → any valid target, Proxied (Worker serves the 301)
classroomio.com zone:
appCNAME → Proxied so the route bindsembedCNAME → Proxied (servesembeds/*from R2 via Worker)apiCNAME → DNS only (server-to-server callers and webhooks bypass the Worker)
BYOD custom domains
Handled by Approximated, not this Worker. Cloudflare for SaaS can't front a Render origin (Render itself runs on Cloudflare), so we use Approximated's dedicated edge cluster instead. See apps/api/src/services/org/domain.ts for the integration. Customers point an A record at the IP Approximated returns; the proxy forwards directly to cio-api.onrender.com.