[PR #18021] [CLOSED] feat(connections): add support for custom HTTP headers #47690

Closed
opened 2026-04-29 23:01:50 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/18021
Author: @mcowger
Created: 10/2/2025
Status: Closed

Base: devHead: mcowger/custom-headers


📝 Commits (1)

  • a3c5e5d feat(connections): add support for custom HTTP headers

📊 Changes

62 files changed (+489 additions, -149 deletions)

View changed files

📝 backend/open_webui/routers/ollama.py (+256 -142)
📝 backend/open_webui/routers/openai.py (+46 -4)
📝 src/lib/apis/openai/index.ts (+19 -2)
📝 src/lib/components/AddConnectionModal.svelte (+103 -1)
📝 src/lib/i18n/locales/ar-BH/translation.json (+1 -0)
📝 src/lib/i18n/locales/ar/translation.json (+1 -0)
📝 src/lib/i18n/locales/bg-BG/translation.json (+1 -0)
📝 src/lib/i18n/locales/bn-BD/translation.json (+2 -0)
📝 src/lib/i18n/locales/bo-TB/translation.json (+1 -0)
📝 src/lib/i18n/locales/bs-BA/translation.json (+1 -0)
📝 src/lib/i18n/locales/ca-ES/translation.json (+1 -0)
📝 src/lib/i18n/locales/ceb-PH/translation.json (+1 -0)
📝 src/lib/i18n/locales/cs-CZ/translation.json (+1 -0)
📝 src/lib/i18n/locales/da-DK/translation.json (+1 -0)
📝 src/lib/i18n/locales/de-DE/translation.json (+1 -0)
📝 src/lib/i18n/locales/dg-DG/translation.json (+1 -0)
📝 src/lib/i18n/locales/el-GR/translation.json (+1 -0)
📝 src/lib/i18n/locales/en-GB/translation.json (+1 -0)
📝 src/lib/i18n/locales/en-US/translation.json (+7 -0)
📝 src/lib/i18n/locales/es-ES/translation.json (+1 -0)

...and 42 more files

📄 Description

This commit introduces the ability for users to define custom HTTP headers for their Ollama and OpenAI connections. Discussion: https://github.com/open-webui/open-webui/discussions/9732

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

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

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Added

  • Support for custom HTTP headers

Description

Key changes include:

  • Centralized header building logic in build_connection_headers (Ollama) and get_headers_and_cookies (OpenAI) to ensure consistent application of headers across all API calls.
  • New extract_custom_headers utility functions in both backend routers to parse user-defined headers from connection configurations.
  • Frontend UI updates in AddConnectionModal.svelte to allow users to add, edit, and remove custom header key-value pairs.
  • Integration of custom headers into various API endpoints for Ollama and OpenAI, ensuring they are included in outgoing requests.
  • Internationalization updates for the new UI elements.

This enhancement provides greater flexibility for users to configure their connections, especially for scenarios requiring specific authentication or routing headers.

Added

  • Support for custom HTTP headers

Changed

NA

Deprecated

NA

Removed

NA

Fixed

NA

Security

NA

Breaking Changes

  • BREAKING CHANGE: NONE

Additional Information

NAS

Screenshots or Videos

Screenshot 2025-10-02 at 4 30 36 PM

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 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/18021 **Author:** [@mcowger](https://github.com/mcowger) **Created:** 10/2/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `mcowger/custom-headers` --- ### 📝 Commits (1) - [`a3c5e5d`](https://github.com/open-webui/open-webui/commit/a3c5e5da2c4f362924e8530161097d918e34fdb3) feat(connections): add support for custom HTTP headers ### 📊 Changes **62 files changed** (+489 additions, -149 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/ollama.py` (+256 -142) 📝 `backend/open_webui/routers/openai.py` (+46 -4) 📝 `src/lib/apis/openai/index.ts` (+19 -2) 📝 `src/lib/components/AddConnectionModal.svelte` (+103 -1) 📝 `src/lib/i18n/locales/ar-BH/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/ar/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/bg-BG/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/bn-BD/translation.json` (+2 -0) 📝 `src/lib/i18n/locales/bo-TB/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/bs-BA/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/ca-ES/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/ceb-PH/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/cs-CZ/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/da-DK/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/de-DE/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/dg-DG/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/el-GR/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/en-GB/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/en-US/translation.json` (+7 -0) 📝 `src/lib/i18n/locales/es-ES/translation.json` (+1 -0) _...and 42 more files_ </details> ### 📄 Description This commit introduces the ability for users to define custom HTTP headers for their Ollama and OpenAI connections. Discussion: https://github.com/open-webui/open-webui/discussions/9732 # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** - [X] **Target branch:** Please verify that the pull request targets the `dev` branch. - [X] **Description:** Provide a concise description of the changes made in this pull request. - [X] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [X] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [X] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [X] **Testing:** Have you written and run sufficient tests to validate the changes? - [X] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [X] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Added - Support for custom HTTP headers ### Description Key changes include: - Centralized header building logic in `build_connection_headers` (Ollama) and `get_headers_and_cookies` (OpenAI) to ensure consistent application of headers across all API calls. - New `extract_custom_headers` utility functions in both backend routers to parse user-defined headers from connection configurations. - Frontend UI updates in `AddConnectionModal.svelte` to allow users to add, edit, and remove custom header key-value pairs. - Integration of custom headers into various API endpoints for Ollama and OpenAI, ensuring they are included in outgoing requests. - Internationalization updates for the new UI elements. This enhancement provides greater flexibility for users to configure their connections, especially for scenarios requiring specific authentication or routing headers. ### Added - Support for custom HTTP headers ### Changed NA ### Deprecated NA ### Removed NA ### Fixed NA ### Security NA ### Breaking Changes - **BREAKING CHANGE**: NONE --- ### Additional Information NAS ### Screenshots or Videos <img width="473" height="501" alt="Screenshot 2025-10-02 at 4 30 36 PM" src="https://github.com/user-attachments/assets/5dd0162a-b06a-4c42-a4e3-bc5bf67b2e7f" /> ### Contributor License Agreement 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. --- <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-04-29 23:01:50 -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#47690