From 526d7e04d7c75c6b5418cd795cb5cc47f506751f Mon Sep 17 00:00:00 2001 From: Umar Adilov <99314948+adilovcode@users.noreply.github.com> Date: Tue, 25 Nov 2025 17:36:42 +0500 Subject: [PATCH] Allowing taylordb domains --- vite.config.ts | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 8b0f57b..6c70beb 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,27 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' +import react from "@vitejs/plugin-react"; +import { defineConfig } from "vite"; -// https://vite.dev/config/ +const allowedHosts = [".develop.taylordb.ai", "localhost", "127.0.0.1"]; + +// https://vitejs.dev/config/ export default defineConfig({ - plugins: [react()], -}) + plugins: [ + react(), + { + name: "host-validation", + configureServer(server) { + server.middlewares.use((req, res, next) => { + const host = req.headers.host?.split(":")[0]; + if (host && allowedHosts.some((allowed) => host.endsWith(allowed))) { + return next(); + } + res.writeHead(403, { "Content-Type": "text/plain" }); + res.end(`Forbidden host: ${host}`); + }); + }, + }, + ], + server: { + host: "0.0.0.0", // Listen on all network interfaces + }, +});