Skip to content

fix: Guest Mode reference URLs unreachable by kie.ai over ngrok - #3

Merged
SegFault42 merged 1 commit into
SegFault42:mainfrom
alaporterie:fix/guest-mode-ngrok-reference-urls
Aug 20, 2026
Merged

fix: Guest Mode reference URLs unreachable by kie.ai over ngrok#3
SegFault42 merged 1 commit into
SegFault42:mainfrom
alaporterie:fix/guest-mode-ngrok-reference-urls

Conversation

@alaporterie

@alaporterie alaporterie commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • In Guest Mode, reference images/videos/audio are stored locally and resolved to a relative /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 with Upload failed: Server internal error, even with CALLBACK_BASE_URL (ngrok) correctly set, since only the callback endpoint was exposed publicly.
  • 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 via 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

  • Guest Mode + ngrok: image-to-video generation with a reference image now succeeds on kie.ai's side (previously failed with Upload failed: Server internal error)
  • Generated video/image still renders correctly in the local gallery (same-origin, no ngrok interstitial)

🤖 Generated with Claude Code

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.
@SegFault42
SegFault42 merged commit 6a302d7 into SegFault42:main Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants