[GH-ISSUE #14399] issue: ENABLE_PERSISTENT_CONFIG=false Required for v0.6.11 Upgrade to Ensure Environment Variables Take Precedence for OAuth Redirects #17237

Closed
opened 2026-04-19 22:56:48 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @IdanYaffe on GitHub (May 27, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/14399

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

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

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

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

  1. Have a working Open WebUI v0.6.9 installation with OAuth and WEBUI_URL environment variable
  2. Upgrade to v0.6.11 using the same configuration
  3. Attempt OAuth authentication
  4. Observe that OAuth redirects use http://localhost:3000 instead of the configured WEBUI_URL

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:

extraEnvVars:
  - name: WEBUI_URL
    value: "https://custom_url.com"
  - name: RESET_CONFIG_ON_START
    value: "true"
  - name: ENABLE_PERSISTENT_CONFIG
    value: "false"

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

Originally created by @IdanYaffe on GitHub (May 27, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/14399 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### 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 - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### 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 1. Have a working Open WebUI v0.6.9 installation with OAuth and WEBUI_URL environment variable 2. Upgrade to v0.6.11 using the same configuration 3. Attempt OAuth authentication 4. Observe that OAuth redirects use http://localhost:3000 instead of the configured WEBUI_URL ### Logs & Screenshots **Root Cause Analysis** The issue stems from the PersistentConfig system in [config.py](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html). 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:** ``` extraEnvVars: - name: WEBUI_URL value: "https://custom_url.com" - name: RESET_CONFIG_ON_START value: "true" - name: ENABLE_PERSISTENT_CONFIG value: "false" ``` **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_
GiteaMirror added the bug label 2026-04-19 22:56:48 -05:00
Author
Owner

@Classic298 commented on GitHub (May 27, 2025):

Not a bug.

Expected Behavior
OAuth redirects should use the WEBUI_URL environment variable value.
Actual Behavior
OAuth redirects default to http://localhost:3000/, causing authentication failures.

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.

<!-- gh-comment-id:2912200556 --> @Classic298 commented on GitHub (May 27, 2025): Not a bug. > Expected Behavior > OAuth redirects should use the WEBUI_URL environment variable value. > Actual Behavior > OAuth redirects default to http://localhost:3000/, causing authentication failures. 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.
Author
Owner

@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.

<!-- gh-comment-id:2912250199 --> @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.
Author
Owner

@Classic298 commented on GitHub (May 27, 2025):

Yeah perhaps docs can be improved on this

I am sure a PR would be welcome

<!-- gh-comment-id:2913942595 --> @Classic298 commented on GitHub (May 27, 2025): Yeah perhaps docs can be improved on this I am sure a PR would be welcome
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#17237