diff --git a/main.js b/main.js index c70a5c3..9aad4f4 100644 --- a/main.js +++ b/main.js @@ -15,6 +15,10 @@ const base = process.env.KENER_BASE_PATH || ""; const app = express(); const db = knex(knexOb); +if (process.env.ORIGIN) { + process.env.SVELTEKIT_ORIGIN = process.env.ORIGIN; +} + app.use((req, res, next) => { if (req.path.startsWith("/embed")) { res.setHeader("Content-Security-Policy", "frame-ancestors *"); diff --git a/vite.config.js b/vite.config.js index 564ac43..b82ad5e 100644 --- a/vite.config.js +++ b/vite.config.js @@ -10,6 +10,7 @@ const PORT = Number(process.env.PORT) || 3000; const base = process.env.KENER_BASE_PATH || ""; const VITE_BUILD_ENV = process.env.VITE_BUILD_ENV || "development"; // Default to "development" const isProduction = VITE_BUILD_ENV === "production"; +const ORIGIN = process.env.ORIGIN || `http://localhost:${PORT}`; export default defineConfig(({ mode }) => ({ optimizeDeps: { @@ -49,6 +50,7 @@ export default defineConfig(({ mode }) => ({ version(), ], server: { + allowedHosts: [new URL(ORIGIN).hostname], port: PORT, watch: { ignored: ["**/src/lib/server/data/**"], // Adjust the path to the file you want to ignore