fix: Guest Mode reference URLs unreachable by kie.ai over ngrok - #3
Merged
SegFault42 merged 1 commit intoAug 20, 2026
Merged
Conversation
Guest Mode stores generated/uploaded files locally and returns relative "/generated/..." URLs. Those work fine for the browser (same-origin), but kie.ai runs on the internet and can't resolve a relative path — any generation using an image/video/audio reference failed with "Upload failed: Server internal error" even though CALLBACK_BASE_URL (ngrok) was set correctly, because only the callback endpoint was exposed publicly, not the reference files themselves. ensureStorage() now prefixes outbound reference URLs with CALLBACK_BASE_URL so kie.ai can fetch them. Stored *results* (mirrored back from kie.ai for local display) are untouched and stay relative, since the browser loads those same-origin — routing them through the ngrok tunnel instead would hit ngrok's free-tier browser-warning interstitial on cross-site requests and silently break playback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/generated/...URL. That's fine for the browser (same-origin) but kie.ai runs on the internet and can't fetch a relative path — any generation using a reference (image-to-video, start/end frame, reference images) failed withUpload failed: Server internal error, even withCALLBACK_BASE_URL(ngrok) correctly set, since only the callback endpoint was exposed publicly.ensureStorage()now prefixes outbound reference URLs withCALLBACK_BASE_URLso kie.ai can fetch them.mirrorToStorage/uploadBuffer) are untouched and stay relative — routing those through the ngrok tunnel instead would hit ngrok free tier's browser-warning interstitial on cross-site<video>/<img>requests and silently break playback in the gallery.Test plan
Upload failed: Server internal error)🤖 Generated with Claude Code