mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-12 18:06:39 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user