mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #21337] [CLOSED] fix: remove API headers when downloading generated images from URLs #41664
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/21337
Author: @shtse8
Created: 2/12/2026
Status: ❌ Closed
Base:
main← Head:fix/image-download-headers📝 Commits (1)
eb0a6b0fix: remove API headers when downloading generated images from URLs📊 Changes
1 file changed (+2 additions, -2 deletions)
View changed files
📝
backend/open_webui/routers/images.py(+2 -2)📄 Description
Summary
When the OpenAI-compatible image generation API returns a URL (instead of base64 data), the code was reusing the same API request headers—including
Content-Type: application/jsonandAuthorization: Bearer ...—to download the image from the returned URL.Since these image URLs typically point to a different server (e.g., cloud storage with pre-signed URLs like Aliyun OSS), sending these inappropriate headers causes 403 Forbidden errors.
Changes
Remove the
headersparameter fromget_image_data()calls in bothimage_generations()andimage_edits()for the OpenAI engine path. The returned image URLs are self-contained (pre-signed) and don't need API authentication headers.Note: ComfyUI engine paths are intentionally left unchanged, as they download images from the same ComfyUI server and correctly construct their own minimal headers.
Root Cause
In
image_generations()(line 644) andimage_edits()(line 992), theheadersdict containing:was passed directly to
get_image_data(), which uses it for a GET request to the image URL. TheContent-Type: application/jsonheader is wrong for a GET image download, and theAuthorizationheader is rejected by external image hosting servers.Fixes #21301
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.