Setup Redis passwords to be used in Vm installation or via Docker

Setup so that CORS_ORIGIN error appears on the frontend to help new installations
This commit is contained in:
Muhammad Ibrahim
2025-10-18 16:14:09 +01:00
parent 52c8ba6b03
commit 5004e062b4
18 changed files with 606 additions and 72 deletions

View File

@@ -339,9 +339,7 @@ const parseOrigins = (val) =>
.map((s) => s.trim())
.filter(Boolean);
const allowedOrigins = parseOrigins(
process.env.CORS_ORIGINS ||
process.env.CORS_ORIGIN ||
"http://localhost:3000",
process.env.CORS_ORIGINS || process.env.CORS_ORIGIN || "http://fabio:3000",
);
app.use(
cors({
@@ -564,6 +562,15 @@ app.use((err, _req, res, _next) => {
if (process.env.ENABLE_LOGGING === "true") {
logger.error(err.stack);
}
// Special handling for CORS errors - always include the message
if (err.message?.includes("Not allowed by CORS")) {
return res.status(500).json({
error: "Something went wrong!",
message: err.message, // Always include CORS error message
});
}
res.status(500).json({
error: "Something went wrong!",
message: process.env.NODE_ENV === "development" ? err.message : undefined,