[PR #24882] [CLOSED] fix: set azure: true for Azure provider on non-azure.* hostnames #131570

Closed
opened 2026-05-21 17:14:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24882
Author: @sergey-zinchenko
Created: 5/18/2026
Status: Closed

Base: devHead: fix/azure-provider-missing-azure-flag


📝 Commits (1)

  • 13a193d fix: persist azure flag so custom Azure hosts work without azure.* URL

📊 Changes

2 files changed (+14 additions, -7 deletions)

View changed files

📝 backend/open_webui/routers/openai.py (+10 -5)
📝 src/lib/components/AddConnectionModal.svelte (+4 -2)

📄 Description

Pull Request Checklist

Before submitting, make sure you've checked the following:

  • Linked Issue/Discussion: Closes #24872. Addresses #17121.
  • Target branch: dev
  • Description: See below.
  • Changelog: See Changelog Entry below.
  • Documentation: Not required — no new user-facing settings; existing Azure OpenAI flow is fixed.
  • Dependencies: None.
  • Testing: Manual — Azure OpenAI provider on custom hostname; Verify succeeds; chat returns a reply. Tested against Azure-compatible gateway (DIAL-style deployment API).
  • Agentic AI Code: Human-reviewed and manually tested.
  • Code review: Self-reviewed.
  • Design & Architecture: Minimal change; no new settings.
  • Git Hygiene: Single logical fix (UI config + backend routing).
  • Title Prefix: fix:

Changelog Entry

Description

  • Fix Azure OpenAI connections on custom base URLs (hostnames without azure. / cognitive.microsoft.com). Selecting Azure OpenAI in the connection modal now persists azure: true, and the backend treats provider: "azure" as Azure mode so verify and chat use deployment API paths (/openai/models, /openai/deployments/{model}/chat/completions).

Added

  • is_azure_openai_config() helper in routers/openai.py for consistent Azure routing checks.

Changed

  • AddConnectionModal.svelte: save azure: true whenever Azure mode is active (including when Provider is Azure OpenAI), not only on URL auto-detection.
  • routers/openai.py: use is_azure_openai_config() instead of api_config.get('azure', False) for verify, models, and chat completion routing.

Deprecated

  • N/A

Removed

  • N/A

Fixed

  • Azure OpenAI provider failing on custom gateway URLs: Verify showed “Network error” and chat returned no reply because only provider: "azure" was saved without azure: true, so requests hit /models and /chat/completions instead of Azure deployment endpoints (#24872).

Security

  • N/A

Breaking Changes

  • N/A

Additional Information

Problem

The Azure OpenAI provider in Admin Panel → Settings → Connections is intended for gateways that use the Azure deployment API (APIM, private endpoints) where the hostname does not trigger auto-detection (azure. / cognitive.microsoft.com).

On save/verify, the UI used:

...(provider ? { provider } : azure ? { azure: true } : {})

Choosing Azure OpenAI stored provider: "azure" but omitted azure: true. The backend only checked api_config.get('azure', False), so verify and chat used generic OpenAI paths and failed on Azure-compatible gateways.

Solution

  1. Frontend: Always persist azure: true when Azure mode is active; keep provider: "azure" when selected.
  2. Backend: is_azure_openai_config() returns true for azure: true or provider === 'azure' (backward compatibility for existing saved configs).

Related

  • Closes #24872
  • Addresses #17121 (custom Azure URLs via explicit provider)

Screenshots or Videos

image
  • Before: Verify → “Network error” on custom host with Azure OpenAI provider
  • After: Verify → success; chat receives assistant reply

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/24882 **Author:** [@sergey-zinchenko](https://github.com/sergey-zinchenko) **Created:** 5/18/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/azure-provider-missing-azure-flag` --- ### 📝 Commits (1) - [`13a193d`](https://github.com/open-webui/open-webui/commit/13a193df3a6cbd85ce46ecab24f11d2a3738bec9) fix: persist azure flag so custom Azure hosts work without azure.* URL ### 📊 Changes **2 files changed** (+14 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/openai.py` (+10 -5) 📝 `src/lib/components/AddConnectionModal.svelte` (+4 -2) </details> ### 📄 Description # Pull Request Checklist **Before submitting, make sure you've checked the following:** - [x] **Linked Issue/Discussion:** Closes #24872. Addresses #17121. - [x] **Target branch:** `dev` - [x] **Description:** See below. - [x] **Changelog:** See Changelog Entry below. - [ ] **Documentation:** Not required — no new user-facing settings; existing Azure OpenAI flow is fixed. - [x] **Dependencies:** None. - [x] **Testing:** Manual — Azure OpenAI provider on custom hostname; Verify succeeds; chat returns a reply. Tested against Azure-compatible gateway (DIAL-style deployment API). - [x] **Agentic AI Code:** Human-reviewed and manually tested. - [x] **Code review:** Self-reviewed. - [x] **Design & Architecture:** Minimal change; no new settings. - [x] **Git Hygiene:** Single logical fix (UI config + backend routing). - [x] **Title Prefix:** `fix:` --- # Changelog Entry ### Description - Fix Azure OpenAI connections on custom base URLs (hostnames without `azure.` / `cognitive.microsoft.com`). Selecting **Azure OpenAI** in the connection modal now persists `azure: true`, and the backend treats `provider: "azure"` as Azure mode so verify and chat use deployment API paths (`/openai/models`, `/openai/deployments/{model}/chat/completions`). ### Added - `is_azure_openai_config()` helper in `routers/openai.py` for consistent Azure routing checks. ### Changed - `AddConnectionModal.svelte`: save `azure: true` whenever Azure mode is active (including when **Provider** is **Azure OpenAI**), not only on URL auto-detection. - `routers/openai.py`: use `is_azure_openai_config()` instead of `api_config.get('azure', False)` for verify, models, and chat completion routing. ### Deprecated - N/A ### Removed - N/A ### Fixed - Azure OpenAI provider failing on custom gateway URLs: **Verify** showed “Network error” and chat returned no reply because only `provider: "azure"` was saved without `azure: true`, so requests hit `/models` and `/chat/completions` instead of Azure deployment endpoints ([#24872](https://github.com/open-webui/open-webui/issues/24872)). ### Security - N/A ### Breaking Changes - N/A --- ### Additional Information **Problem** The **Azure OpenAI** provider in Admin Panel → Settings → Connections is intended for gateways that use the Azure deployment API (APIM, private endpoints) where the hostname does not trigger auto-detection (`azure.` / `cognitive.microsoft.com`). On save/verify, the UI used: ```js ...(provider ? { provider } : azure ? { azure: true } : {}) ``` Choosing **Azure OpenAI** stored `provider: "azure"` but omitted `azure: true`. The backend only checked `api_config.get('azure', False)`, so verify and chat used generic OpenAI paths and failed on Azure-compatible gateways. **Solution** 1. **Frontend:** Always persist `azure: true` when Azure mode is active; keep `provider: "azure"` when selected. 2. **Backend:** `is_azure_openai_config()` returns true for `azure: true` or `provider === 'azure'` (backward compatibility for existing saved configs). **Related** - Closes [#24872](https://github.com/open-webui/open-webui/issues/24872) - Addresses [#17121](https://github.com/open-webui/open-webui/issues/17121) (custom Azure URLs via explicit provider) ### Screenshots or Videos <img width="3115" height="1422" alt="image" src="https://github.com/user-attachments/assets/6de31377-54fb-4fb9-be58-365b09ab886b" /> - [ ] Before: Verify → “Network error” on custom host with **Azure OpenAI** provider - [X] After: Verify → success; chat receives assistant reply ### Contributor License Agreement - [X] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-21 17:14:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#131570