fix: preserve trailing slash in MCP server URLs (#21212)

Stop trimming trailing slashes from MCP server URLs on save. Some MCP
servers (e.g. Bitrix24) require a trailing slash; removing it triggers a
301 redirect that drops Authorization headers, resulting in 400 errors.

The trailing-slash trim is now skipped when the connection type is 'mcp',
while OpenAPI connections continue to have it stripped as before.

Fixes open-webui#21179
This commit is contained in:
Varun Chawla
2026-02-15 19:09:41 -06:00
committed by GitHub
parent 3ae4c618e1
commit 24179cde2f
+6 -2
View File
@@ -250,8 +250,12 @@
const submitHandler = async () => {
loading = true;
// remove trailing slash from url
url = url.replace(/\/$/, '');
// remove trailing slash from url for non-MCP connections
// MCP servers may require a trailing slash; stripping it can cause
// 301 redirects that lose auth headers (see #21179)
if (type !== 'mcp') {
url = url.replace(/\/$/, '');
}
if (id.includes(':') || id.includes('|')) {
toast.error($i18n.t('ID cannot contain ":" or "|" characters'));
loading = false;