This repository was archived by the owner on Feb 2, 2024. It is now read-only.
Description Prerequisites
fast-proxy version
2.0.0
Node.js version
12.20
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
10.15
Description
When I try to use fast-proxy with undici as client on a next.js API route to proxy browser requests i get an 500 error invalid connection header
Steps to Reproduce
create next.js app
create pages/v1/[...args].js (route to proxy)
add the proxy code
import { NextApiRequest , NextApiResponse } from 'next' ;
const { proxy } = require ( 'fast-proxy' ) ( {
base : process . env . EXTERNAL_API_URL ,
undici : {
connections : 100 ,
pipelining : 0 ,
} ,
} ) ;
export default function api ( req : NextApiRequest , res : NextApiResponse ) {
return runMiddleware ( req , res , ( ) => proxy ( req , res , req . url , { } ) ) ;
}
export const config = {
api : {
bodyParser : false ,
} ,
} ;
//@ts -expect-error
function runMiddleware ( req , res , fn ) {
return new Promise ( ( resolve , reject ) => {
//@ts -expect-error
fn ( req , res , ( result ) => {
if ( result instanceof Error ) {
return reject ( result ) ;
}
return resolve ( result ) ;
} ) ;
} ) ;
}
when performing a request, it get's captured and passed to the proxy, the proxy returns 500, this doesn't happen if I remove the undici options.
Expected Behavior
When I perform a proxy request with undici activated, it should not return 500
Reactions are currently unavailable
Prerequisites
fast-proxy version
2.0.0
Node.js version
12.20
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
10.15
Description
When I try to use fast-proxy with undici as client on a next.js API route to proxy browser requests i get an 500 error
invalid connection headerSteps to Reproduce
pages/v1/[...args].js(route to proxy)Expected Behavior
When I perform a proxy request with undici activated, it should not return 500