getDisplayMedia (screen capture) requires a secure context, so LAN staff access now goes through nginx on a real trusted cert (local-summit.mydentalofficemanagement.com, issued via certbot's Cloudflare DNS-01 plugin) instead of plain HTTP. A separate public hostname/nginx block is reserved for Twilio webhooks only, routed through Cloudflare Tunnel so nothing else is exposed to the internet. Also fixes the backend CORS allowlist for the new hostname, and stops the Socket.IO client from bypassing nginx to hit the backend directly on :5000 (which broke under TLS/mixed content).
53 lines
1.6 KiB
TypeScript
Executable File
53 lines
1.6 KiB
TypeScript
Executable File
import { defineConfig, loadEnv } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import path from "path";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), "");
|
|
|
|
return {
|
|
plugins: [react()],
|
|
server: {
|
|
host: env.HOST,
|
|
port: Number(env.PORT),
|
|
fs: {
|
|
allow: [".."],
|
|
},
|
|
allowedHosts: [
|
|
...(env.VITE_CLOUDFLARE_HOST ? [env.VITE_CLOUDFLARE_HOST] : []),
|
|
"192.168.0.94",
|
|
"local-summit.mydentalofficemanagement.com",
|
|
],
|
|
proxy: {
|
|
"/api": {
|
|
target: env.VITE_API_BASE_URL_BACKEND || "http://localhost:5000",
|
|
changeOrigin: true,
|
|
configure: (proxy) => {
|
|
proxy.on("proxyReq", (proxyReq, req) => {
|
|
const auth = (req as any).headers["authorization"];
|
|
if (auth) proxyReq.setHeader("Authorization", auth);
|
|
});
|
|
},
|
|
},
|
|
"/socket.io": {
|
|
target: env.VITE_API_BASE_URL_BACKEND || "http://localhost:5000",
|
|
changeOrigin: true,
|
|
ws: true,
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
extensions: [".mts", ".ts", ".tsx", ".mjs", ".js", ".jsx", ".json"],
|
|
alias: {
|
|
"@": path.resolve(__dirname, "src"),
|
|
"@repo/db/usedSchemas": path.resolve(__dirname, "../../packages/db/usedSchemas/browser.ts"),
|
|
"@repo/db/types": path.resolve(__dirname, "../../packages/db/types/index.ts"),
|
|
"@repo/db": path.resolve(__dirname, "../../packages/db"),
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
exclude: ["@repo/db"],
|
|
},
|
|
};
|
|
});
|