mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 04:16:03 -05:00
[GH-ISSUE #14399] issue: ENABLE_PERSISTENT_CONFIG=false Required for v0.6.11 Upgrade to Ensure Environment Variables Take Precedence for OAuth Redirects #55903
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 @IdanYaffe on GitHub (May 27, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/14399
Check Existing Issues
Installation Method
Docker
Open WebUI Version
0.6.11
Ollama Version (if applicable)
No response
Operating System
Ubuntu 22.04
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
OAuth redirects should use the WEBUI_URL environment variable value.
Actual Behavior
OAuth redirects default to http://localhost:3000, causing authentication failures.
Steps to Reproduce
Logs & Screenshots
Root Cause Analysis
The issue stems from the PersistentConfig system in config.py. The OAuth redirect logic in backend/open_webui/utils/oauth.py (lines 523-545) uses request.app.state.config.WEBUI_URL or request.base_url. The PersistentConfig system loads values from the database with higher priority than environment variables, even when RESET_CONFIG_ON_START=true.
Investigation Details
Configuration Loading: Despite RESET_CONFIG_ON_START=true, application logs showed "loading from the latest database entry"
PersistentConfig Priority: The database-stored configuration takes precedence over environment variables
OAuth Logic: The redirect uses the config value which comes from the database, not the environment variable
Solution/Workaround
Setting ENABLE_PERSISTENT_CONFIG=false disables the persistent configuration system entirely, allowing environment variables to take precedence. This resolves the OAuth redirect issue.
Working Configuration:
Verification
After applying ENABLE_PERSISTENT_CONFIG=false:
OAuth redirects work correctly with the configured WEBUI_URL
Application responds normally (HTTP 200)
All functionality remains intact
Suggested Improvements
Documentation Update: Add a note in the upgrade documentation for v0.6.11 mentioning that ENABLE_PERSISTENT_CONFIG=false may be needed when upgrading to ensure environment variables take precedence
Configuration Priority: Consider reviewing the configuration priority system to ensure environment variables can override database values when RESET_CONFIG_ON_START=true
Migration Guide: Provide clear guidance for users upgrading from previous versions about configuration management changes
Impact
This affects users upgrading to v0.6.11 who rely on environment variables for configuration, particularly in containerized deployments where environment variables are the primary configuration method.
Note: This issue was discovered and resolved during a production upgrade. The solution (ENABLE_PERSISTENT_CONFIG=false) works correctly but may not be immediately obvious to users encountering this problem during upgrades.
Additional Information
No response
@Classic298 commented on GitHub (May 27, 2025):
Not a bug.
Your expected behaviour is correct. That's what it should do (and does!).
The actual behaviour is incorrect.
But you misunderstand how PersistentConfig variables work. Once they have been set on the backend, ever, then that's the value now and you cannot change that from the environment variables.
Meaning: You should change the WEBUI_URL from the admin panel!
Change it there, and it will redirect correctly to where you want it to redirect.
Also PLEASE check existing issues and discussions
There are already two closed issues/discussions for exactly this topic with the solution posted.
@IdanYaffe commented on GitHub (May 27, 2025):
@Classic298 thanks for your response.
I did search through open issues, docs, and the code base for that before opening the issue.
I did miss the closed ones, sorry for that.
Having said that, I don't think that setting the WEBUI_URL via the UI is documented properly/it's not clear enough.
The best proof of that is the additional issues that people have created today.
I would really prefer to be able to set it via the env vars and for those to take precedence.
This is especially important when managing openwebui via code or when having multiple env where each has a different base url.
@Classic298 commented on GitHub (May 27, 2025):
Yeah perhaps docs can be improved on this
I am sure a PR would be welcome