mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 16:23:41 +08:00 
			
		
		
		
	Merge pull request #1863 from Yidadaa/bugfix-0608
feat: just disable all ngnix buffering
This commit is contained in:
		@@ -73,18 +73,18 @@ export async function requestOpenai(req: NextRequest) {
 | 
				
			|||||||
  try {
 | 
					  try {
 | 
				
			||||||
    const res = await fetch(fetchUrl, fetchOptions);
 | 
					    const res = await fetch(fetchUrl, fetchOptions);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (res.status === 401) {
 | 
					    // to prevent browser prompt for credentials
 | 
				
			||||||
      // to prevent browser prompt for credentials
 | 
					    const newHeaders = new Headers(res.headers);
 | 
				
			||||||
      const newHeaders = new Headers(res.headers);
 | 
					    newHeaders.delete("www-authenticate");
 | 
				
			||||||
      newHeaders.delete("www-authenticate");
 | 
					 | 
				
			||||||
      return new Response(res.body, {
 | 
					 | 
				
			||||||
        status: res.status,
 | 
					 | 
				
			||||||
        statusText: res.statusText,
 | 
					 | 
				
			||||||
        headers: newHeaders,
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return res;
 | 
					    // to disbale ngnix buffering
 | 
				
			||||||
 | 
					    newHeaders.set("X-Accel-Buffering", "no");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return new Response(res.body, {
 | 
				
			||||||
 | 
					      status: res.status,
 | 
				
			||||||
 | 
					      statusText: res.statusText,
 | 
				
			||||||
 | 
					      headers: newHeaders,
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
  } finally {
 | 
					  } finally {
 | 
				
			||||||
    clearTimeout(timeoutId);
 | 
					    clearTimeout(timeoutId);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user