Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ import { cloudOnboardingRoutes } from './platform/cloud/onboarding/onboardingClo

const isFileProtocol = window.location.protocol === 'file:'

// Determine base path for the router
// - Electron: always root
// - Web: rely on Vite's BASE_URL (configured via vite.config `base`)
/**
* Determine base path for the router.
* - Electron: always root
* - Cloud: use Vite's BASE_URL (configured at build time)
* - Standard web (including reverse proxy subpaths): use window.location.pathname
* to support deployments like http://mysite.com/ComfyUI/
*/
function getBasePath(): string {
if (isElectron()) return '/'
// Vite injects BASE_URL at build/dev time; default to '/'
return import.meta.env?.BASE_URL || '/'
if (isCloud) return import.meta.env?.BASE_URL || '/'
return window.location.pathname
}

const basePath = getBasePath()
Expand Down