Skip to content

Commit be942fb

Browse files
[backport rh-test] Fix cloud routing issues caused by incorrect api_base calculation (#6578)
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 <[email protected]>
1 parent 6f9bef3 commit be942fb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/scripts/api.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,13 @@ export class ComfyApi extends EventTarget {
382382
super()
383383
this.user = ''
384384
this.api_host = location.host
385-
this.api_base = location.pathname.split('/').slice(0, -1).join('/')
385+
const pathname = location.pathname
386+
const isCloudSpaRoute = isCloud && pathname.startsWith('/cloud/')
387+
if (isCloudSpaRoute) {
388+
this.api_base = ''
389+
} else {
390+
this.api_base = pathname.split('/').slice(0, -1).join('/')
391+
}
386392
console.log('Running on', this.api_host)
387393
this.initialClientId = sessionStorage.getItem('clientId')
388394
}

0 commit comments

Comments
 (0)