mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-15 21:19:39 -05:00
[PR #24015] [MERGED] perf: redirect default model profile image to static favicon for cache reuse #43108
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24015
Author: @jmleksan
Created: 4/22/2026
Status: ✅ Merged
Merged: 4/24/2026
Merged by: @tjbck
Base:
dev← Head:perf/static-redirect📝 Commits (1)
2752d74perf: redirect default model profile image to canonical static URL📊 Changes
1 file changed (+49 additions, -4 deletions)
View changed files
📝
backend/open_webui/routers/models.py(+49 -4)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch. PRs targetingmainwill be immediately closed.devto ensure no unrelated commits (e.g. frommain) are included. Push updates to the existing PR branch instead of closing and reopening.Changelog Entry
Description
Default model avatars are served from
GET /api/v1/models/model/profile/image?id=…. Each distinct model id produced a different URL but the same fallback file (static/favicon.png, ~22 KB). Browsers therefore downloaded that payload multiple times (visible in Lighthouse transfer size / LCP-related loading).This change returns HTTP 302 to the canonical static URL
/static/favicon.pngfor the default case, and 302 tometa.profile_image_urlwhen it is already a site-relative path under/static/. Custom images (http(s):redirects anddata:imageinline bodies) are unchanged.Impact: Fewer redundant bytes on pages that show several model avatars; better cache reuse for the default icon. API behavior: clients that expected
200with a PNG body for the default case now receive a redirect (standard for browsers loading<img src="…">).Added
meta.profile_image_urlvalues that start with/static/.Changed
get_model_profile_imagenow respond withRedirectResponseto/static/favicon.pnginstead ofFileResponseof the same file from the API route.Fixed
Security
/static/…for stored relative paths, or the fixed default/static/favicon.png(no open redirect to arbitrary hosts).Breaking Changes
GET …/model/profile/imageand assumed a200response with an image body for models without a custom image will now receive302to/static/favicon.pnginstead. Browsers and typical<img>usage follow redirects by default.Additional Information
profile/image→ load chat/home with multiple default model pills; observe multiple ~22 KB responses (one perid)./static/favicon.png; subsequent avatars should reuse cache after redirect (depending on cache headers), and per-model responses are small 302s instead of full PNG bodies.Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.