mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[GH-ISSUE #15486] issue: Static assets and API requests fail when Open WebUI is hosted on a subpath #56242
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?
Originally created by @brianredbeard on GitHub (Jul 2, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/15486
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
59ba21bdfOllama Version (if applicable)
No response
Operating System
N/A
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
When Open WebUI is deployed behind a reverse proxy and served from a subpath (e.g., https://example.com/webui/), the application fails to load. This is due to two related issues:
1 Static asset URLs in src/app.html are hardcoded as root-relative paths, causing them to be requested from the domain root instead of the application's subpath.
2 The base URL for API requests, defined in src/lib/constants.ts, does not correctly resolve the subpath in a production environment. This affects all API calls and SvelteKit's ability to load its own JavaScript chunks.
The combination of these issues results in numerous 404 Not Found and NS_ERROR_CORRUPTED_CONTENT errors, preventing the application from initializing.
Actual Behavior
The application is unusable and fails to render. The browser's network inspector shows multiple failed requests:
• 404 Not Found errors for static assets like favicon.png and splash.png.
• NS_ERROR_CORRUPTED_CONTENT for SvelteKit's JavaScript chunks, which are incorrectly requested from the root /_app/ directory instead of the subpath.
Steps to Reproduce
1 Configure Open WebUI to be served from a subpath using a reverse proxy (e.g., /webui). (e.g. WEBUI_API_BASE_URL, WEBUI_BASE_URL)
2 Build and run the application in production mode.
3 Navigate to the application's URL (https://example.com/webui/).
4 Open the browser's developer tools and observe the Network tab.
Logs & Screenshots
Additional Information
Root Cause Analysis & Code Citations
1 Hardcoded Static Asset Paths in src/app.html
The primary HTML template at src/app.html uses root-relative paths for all static assets. These paths do not account for the application's base path when deployed on a subpath.
Code Citation (src/app.html):
These paths should be prefixed with SvelteKit's base path variable, %sveltekit.paths.base%, to ensure they are resolved correctly relative to the deployment subpath.
2 Incorrect Base URL Construction in src/lib/constants.ts
The WEBUI_BASE_URL constant, which serves as the foundation for all API endpoints, is not correctly configured to use SvelteKit's base path in a production environment. The existing logic resolves to an empty string for the base path.
Code Citation (illustrating the faulty logic in src/lib/constants.ts): The WEBUI_BASE_URL logic for a production browser environment effectively becomes '' instead of incorporating the subpath provided by SvelteKit's $app/paths. This incorrect base
URL is then used to construct WEBUI_API_BASE_URL, causing all API requests to be sent to the wrong path. Furthermore, this misconfiguration prevents SvelteKit from correctly locating its own JavaScript modules, as seen by the failing requests to
/_app/immutable/....
@tjbck commented on GitHub (Jul 2, 2025):
PLEASE check for existing/previous issues and discussions, this will not be officially supported for the foreseeable future due to our bandwidth. With that being said, we may be more receptive to any PRs regarding this, but we'd be hesitant unless we're convinced that this won't open up a whole new can of worms.