We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c03abda + dd6e799 commit 350ddd2Copy full SHA for 350ddd2
app/api/common.ts
@@ -122,6 +122,12 @@ export async function requestOpenai(req: NextRequest) {
122
// to disable nginx buffering
123
newHeaders.set("X-Accel-Buffering", "no");
124
125
+ // The latest version of the OpenAI API forced the content-encoding to be "br" in json response
126
+ // So if the streaming is disabled, we need to remove the content-encoding header
127
+ // Because Vercel uses gzip to compress the response, if we don't remove the content-encoding header
128
+ // The browser will try to decode the response with brotli and fail
129
+ newHeaders.delete("content-encoding");
130
+
131
return new Response(res.body, {
132
status: res.status,
133
statusText: res.statusText,
0 commit comments