fix: resolve media proxy relay URL dynamically per-request#518
Merged
Conversation
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.
This was referenced May 28, 2026
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.
Problem
The axum media proxy bakes in the relay base URL at startup (
spawn_media_proxycaptures aString). When the user switches workspaces in the GUI,apply_workspace()updatesrelay_url_overrideinAppState, 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 stagingthen adding a production relay via the GUI).Fix
Replace the frozen
base_url: StringinProxyStatewithapp_handle: tauri::AppHandle, and resolve the relay URL dynamically per-request viarelay_api_base_url_with_override(&app_state)— the same pattern already used byhandle_sprout_media(thesprout-media://protocol handler, which doesn't have this bug).Changes
media_proxy.rs: StoreAppHandleinstead ofString; resolve URL inproxy_handlerlib.rs: Passapp_handle.clone()tospawn_media_proxyinstead of pre-computed URL2 files changed, +9 / -8 lines.