Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: add optional CDN URL configuration for static assets in Vite

Victor Santos9fae065e2430
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index ace4852ac1..e703f1cf68 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -29,7 +29,14 @@ export default defineConfig(({ mode }) => {
"0.0.1"
).replaceAll(".", "-");
+ // Optional CDN URL for static assets (e.g., https://cdn.example.com)
+ // When set, all static assets will be served from this URL instead of the same origin.
+ // This is useful for serving assets from a CDN subdomain while keeping API calls on the main domain.
+ // If not set, assets are served from the same origin (backward compatible).
+ const cdnUrl = env.VITE_CDN_URL || "";
+
return {
+ base: cdnUrl || "/",
server: {
allowedHosts,
host: true,