feat(ccc): added in forwarder to the ccc, currently always sending there

This commit is contained in:
2026-06-23 14:23:43 -05:00
parent bc4728a156
commit 263c7095a8
3 changed files with 14014 additions and 13982 deletions

View File

@@ -2,6 +2,7 @@ import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { toNodeHandler } from "better-auth/node";
import express from "express";
import { createProxyMiddleware } from "http-proxy-middleware";
import morgan from "morgan";
import { umamiConfig } from "./configs/umami.config.js";
import { createLogger } from "./logger/logger.controller.js";
@@ -58,6 +59,22 @@ const createApp = async () => {
setupRoutes(baseUrl, app);
// point to the ccc
// TODO: gate this behind a feature switch
app.use(
baseUrl + "/ccc",
createProxyMiddleware({
target: `http://localhost:${process.env.CCC || "5000"}`,
changeOrigin: true,
pathRewrite: (path, _) => {
return path.replace(`${baseUrl}/ccc`, "");
},
headers: {
"X-Forwarded-By": "express-proxy",
},
}),
);
app.use(
`${baseUrl}/app`,
express.static(join(__dirname, "../frontend/dist")),