Skip to content

fix: resolve media proxy relay URL dynamically per-request#518

Merged
tlongwell-block merged 1 commit into
mainfrom
fix/dynamic-media-proxy-url
May 9, 2026
Merged

fix: resolve media proxy relay URL dynamically per-request#518
tlongwell-block merged 1 commit into
mainfrom
fix/dynamic-media-proxy-url

Conversation

@tlongwell-block
Copy link
Copy Markdown
Collaborator

@tlongwell-block tlongwell-block commented May 9, 2026

Problem

The axum media proxy bakes in the relay base URL at startup (spawn_media_proxy captures a String). When the user switches workspaces in the GUI, apply_workspace() updates relay_url_override in AppState, but the proxy still forwards requests to the old relay → 404 → broken images.

This only affects users who switch between relays (e.g. running just staging then adding a production relay via the GUI).

Fix

Replace the frozen base_url: String in ProxyState with app_handle: tauri::AppHandle, and resolve the relay URL dynamically per-request via relay_api_base_url_with_override(&app_state) — the same pattern already used by handle_sprout_media (the sprout-media:// protocol handler, which doesn't have this bug).

Changes

  • media_proxy.rs: Store AppHandle instead of String; resolve URL in proxy_handler
  • lib.rs: Pass app_handle.clone() to spawn_media_proxy instead of pre-computed URL

2 files changed, +9 / -8 lines.

The axum media proxy was baking in the relay base URL at startup,
so switching workspaces in the GUI left the proxy pointed at the
old relay — resulting in 404s and broken images.

Now reads relay_url_override from AppState on every request,
matching the pattern already used by handle_sprout_media.

Fixes broken images when switching between relays.
@tlongwell-block tlongwell-block enabled auto-merge (squash) May 9, 2026 02:57
@tlongwell-block tlongwell-block merged commit 90b0af1 into main May 9, 2026
15 checks passed
@tlongwell-block tlongwell-block deleted the fix/dynamic-media-proxy-url branch May 9, 2026 02:59
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.

1 participant