From d700cbeb9ad625d0f2f4e8932af826e8e52c8c94 Mon Sep 17 00:00:00 2001 From: akira-cn Date: Fri, 10 Nov 2023 20:42:12 +0800 Subject: [PATCH] fix: remove the content-encoding header --- app/api/common.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/common.ts b/app/api/common.ts index 0d269dfb5..58037645e 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -128,8 +128,8 @@ export async function requestOpenai(req: NextRequest) { // The latest version of the OpenAI API forced the content-encoding to be "br" in json response // So if the streaming is disabled, we need to remove the content-encoding header - // But vercel uses gzip to compress the response - // So we need to remove the content-encoding header + // Because Vercel uses gzip to compress the response, if we don't remove the content-encoding header + // The browser will try to decode the response with brotli and fail newHeaders.delete("content-encoding"); return new Response(res.body, {