mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[PR #21212] [MERGED] fix: preserve trailing slash in MCP server URLs #25971
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?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21212
Author: @veeceey
Created: 2/6/2026
Status: ✅ Merged
Merged: 2/16/2026
Merged by: @tjbck
Base:
dev← Head:fix/issue-21179-mcp-trailing-slash📝 Commits (1)
5a33b19fix: preserve trailing slash in MCP server URLs📊 Changes
1 file changed (+6 additions, -2 deletions)
View changed files
📝
src/lib/components/AddToolServerModal.svelte(+6 -2)📄 Description
Pull Request Checklist
devbranch.fix:to categorize this pull request.Changelog Entry
Description
Fixes MCP server URLs having their trailing slashes stripped on save, causing 301 redirects that drop
Authorizationheaders (resulting in400 Bad Request). The trailing-slash trim is now conditionally skipped when the connection type ismcp, while OpenAPI connections continue to behave as before.Fixes #21179
Changed
src/lib/components/AddToolServerModal.svelte:type !== 'mcp'guard so MCP server URLs are preserved exactly as enteredFixed
Additional Information
Root Cause
In
AddToolServerModal.svelte, thesubmitHandlerunconditionally stripped trailing slashes:This is correct for OpenAPI connections (which append paths like
/openapi.json), but MCP (Streamable HTTP) URLs are used as-is for direct POST requests. Some MCP servers (e.g., Bitrix24) require a trailing slash. Without it, the server responds with a 301 redirect, and the HTTP client drops theAuthorizationheader on redirect, causing a400 Bad Request.Fix
Screenshots or Videos
Test Results
https://api.example.com/mcp/https://api.example.com/mcp(broken)https://api.example.com/mcp/(works)https://api.example.com/mcphttps://api.example.com/mcphttps://api.example.com/mcphttps://api.example.com/v1/https://api.example.com/v1https://api.example.com/v1https://api.example.com/v1https://api.example.com/v1https://api.example.com/v1Contributor 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.