feat(ccc): added in forwarder to the ccc, currently always sending there
This commit is contained in:
@@ -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")),
|
||||
|
||||
Reference in New Issue
Block a user