From: Gaetan Bisson Date: Wed, 18 Dec 2024 14:00:07 +0000 (-1000) Subject: server: avoid overwriting Authorization header (#10878) X-Git-Tag: upstream/0.0.4488~132 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=7bbb5acf125d1d2840cac7d31b9aaa72210dd5ec;p=pkg%2Fggml%2Fsources%2Fllama.cpp server: avoid overwriting Authorization header (#10878) * server: avoid overwriting Authorization header If no API key is set, leave the Authorization header as is. It may be used by another part of the Web stack, such as an authenticating proxy. Fixes https://github.com/ggerganov/llama.cpp/issues/10854 * rebuild --------- Co-authored-by: Xuan Son Nguyen --- diff --git a/examples/server/public/index.html.gz b/examples/server/public/index.html.gz index 01dd41811..6a6491557 100644 Binary files a/examples/server/public/index.html.gz and b/examples/server/public/index.html.gz differ diff --git a/examples/server/webui/src/main.js b/examples/server/webui/src/main.js index 2a3021ce9..997ab0ff5 100644 --- a/examples/server/webui/src/main.js +++ b/examples/server/webui/src/main.js @@ -445,7 +445,7 @@ const mainApp = createApp({ method: 'POST', headers: { 'Content-Type': 'application/json', - 'Authorization': this.config.apiKey ? `Bearer ${this.config.apiKey}` : undefined, + ...(this.config.apiKey ? {'Authorization': `Bearer ${this.config.apiKey}`} : {}) }, body: JSON.stringify(params), signal: abortController.signal,