From be942fb56480da92ad21042a78359fe59e793bbc Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Wed, 5 Nov 2025 17:39:03 +0900 Subject: [PATCH] [backport rh-test] Fix cloud routing issues caused by incorrect api_base calculation (#6578) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of #6572 to `rh-test` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6578-backport-rh-test-Fix-cloud-routing-issues-caused-by-incorrect-api_base-calculation-2a16d73d36508157a3edfca38af1cf03) by [Unito](https://www.unito.io) Co-authored-by: Jin Yi --- src/scripts/api.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/scripts/api.ts b/src/scripts/api.ts index 7dd6ab4d1..c935ce343 100644 --- a/src/scripts/api.ts +++ b/src/scripts/api.ts @@ -382,7 +382,13 @@ export class ComfyApi extends EventTarget { super() this.user = '' this.api_host = location.host - this.api_base = location.pathname.split('/').slice(0, -1).join('/') + const pathname = location.pathname + const isCloudSpaRoute = isCloud && pathname.startsWith('/cloud/') + if (isCloudSpaRoute) { + this.api_base = '' + } else { + this.api_base = pathname.split('/').slice(0, -1).join('/') + } console.log('Running on', this.api_host) this.initialClientId = sessionStorage.getItem('clientId') }