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:
1 parent
3ae4c618e1
commit
24179cde2f
1 file changed
+6
-2
@@ -250,8 +250,12 @@
|
|||||||
const submitHandler = async () => {
|
const submitHandler = async () => {
|
||||||
loading = true;
|
loading = true;
|
||||||
|
|
||||||
// remove trailing slash from url
|
// remove trailing slash from url for non-MCP connections
|
||||||
url = url.replace(/\/$/, '');
|
// 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('|')) {
|
if (id.includes(':') || id.includes('|')) {
|
||||||
toast.error($i18n.t('ID cannot contain ":" or "|" characters'));
|
toast.error($i18n.t('ID cannot contain ":" or "|" characters'));
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|||||||
Reference in new issue
Block a user