API keys only work after first login upon server restart #3145

Closed
opened 2025-11-11 15:23:35 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @ghmer on GitHub (Dec 30, 2024).

Bug Report

Installation Method

docker-compose stack with open-webui, ollama and redis

Environment

  • Open WebUI Version: 0.5.2

  • Ollama (if applicable): 0.5.4

  • Operating System: debian

  • Browser (if applicable): not applicable

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on 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 the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

An API key should work regardless of a user login. When a server is restarted, the owner of an API key should not be required to login before their API key can be used.

Actual Behavior:

Upon server/docker stack restart, I receive "HTTP 400: Bad Gateway" responses using http requests with an "Authorization: Bearer API_KEY" header until I logon to open-webui via browser.

Description

Bug Summary:
After a server restart, http requests to the Ollama backend via open-webui (authenticated via API key) results in "http 400 - Bad Gateway" responses. The issue persists unless the owner of the API key logs into open-webui via browser. Then, the API key is working properly until the next server restart.

Reproduction Details

Steps to Reproduce:

  • Login to open-webui via browser. Retrieve your API key
  • Test your API key. You should get responses from the api backend (for example, ollama)
  • restart the server
  • Test your API key. You will get "http 400 - Bad Gateway" responses
  • Login to open-webui via browser.
  • Test your API key again. It is working properly, now.
Originally created by @ghmer on GitHub (Dec 30, 2024). # Bug Report ## Installation Method docker-compose stack with open-webui, ollama and redis ## Environment - **Open WebUI Version:** 0.5.2 - **Ollama (if applicable):** 0.5.4 - **Operating System:** debian - **Browser (if applicable):** not applicable **Confirmation:** - [x] I have read and followed all the instructions provided in the README.md. - [x] I am on the latest version of both Open WebUI and Ollama. - [ ] I have included the browser console logs. - [ ] I have included the Docker container logs. - [x] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: An API key should work regardless of a user login. When a server is restarted, the owner of an API key should not be required to login before their API key can be used. ## Actual Behavior: Upon server/docker stack restart, I receive "HTTP 400: Bad Gateway" responses using http requests with an "Authorization: Bearer API_KEY" header until I logon to open-webui via browser. ## Description **Bug Summary:** After a server restart, http requests to the Ollama backend via open-webui (authenticated via API key) results in "http 400 - Bad Gateway" responses. The issue persists unless the owner of the API key logs into open-webui via browser. Then, the API key is working properly until the next server restart. ## Reproduction Details **Steps to Reproduce:** - Login to open-webui via browser. Retrieve your API key - Test your API key. You should get responses from the api backend (for example, ollama) - restart the server - Test your API key. You will get "http 400 - Bad Gateway" responses - Login to open-webui via browser. - Test your API key again. It is working properly, now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#3145