Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Fix allow (#108)

Bill Yang696c6b614523
diff --git a/server/src/lib/allowedDomains.ts b/server/src/lib/allowedDomains.ts
index 6e765bf48..0d67ae6ce 100644
--- a/server/src/lib/allowedDomains.ts
+++ b/server/src/lib/allowedDomains.ts
@@ -1,5 +1,6 @@
import { db, sql } from "../db/postgres/postgres.js";
import { sites } from "../db/postgres/schema.js";
+import { normalizeOrigin } from "../utils.js";
import { initAuth } from "./auth.js";
import dotenv from "dotenv";
@@ -27,15 +28,14 @@ export const loadAllowedDomains = async () => {
}
allowList = [
- "http://localhost:3002",
- process.env.BASE_URL || "",
+ "localhost",
+ normalizeOrigin(process.env.BASE_URL || ""),
...domains.map(({ domain }) => domain),
];
- initAuth(allowList);
} catch (error) {
console.error("Error loading allowed domains:", error);
// Set default values in case of error
- allowList = ["http://localhost:3002", process.env.BASE_URL || ""];
+ allowList = ["localhost", normalizeOrigin(process.env.BASE_URL || "")];
initAuth(allowList);
}
};