File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1326,6 +1326,9 @@ function httpRedirectFetch (fetchParams, response) {
13261326 // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
13271327 request . headersList . delete ( 'authorization' , true )
13281328
1329+ // https://fetch.spec.whatwg.org/#authentication-entries
1330+ request . headersList . delete ( 'proxy-authorization' , true )
1331+
13291332 // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
13301333 request . headersList . delete ( 'cookie' , true )
13311334 request . headersList . delete ( 'host' , true )
Original file line number Diff line number Diff line change @@ -7,11 +7,12 @@ const { once } = require('node:events')
77const { fetch } = require ( '../..' )
88
99test ( 'Cross-origin redirects clear forbidden headers' , async ( t ) => {
10- const { strictEqual } = tspl ( t , { plan : 5 } )
10+ const { strictEqual } = tspl ( t , { plan : 6 } )
1111
1212 const server1 = createServer ( ( req , res ) => {
1313 strictEqual ( req . headers . cookie , undefined )
1414 strictEqual ( req . headers . authorization , undefined )
15+ strictEqual ( req . headers [ 'proxy-authorization' ] , undefined )
1516
1617 res . end ( 'redirected' )
1718 } ) . listen ( 0 )
@@ -40,7 +41,8 @@ test('Cross-origin redirects clear forbidden headers', async (t) => {
4041 const res = await fetch ( `http://localhost:${ server2 . address ( ) . port } ` , {
4142 headers : {
4243 Authorization : 'test' ,
43- Cookie : 'ddd=dddd'
44+ Cookie : 'ddd=dddd' ,
45+ 'Proxy-Authorization' : 'test'
4446 }
4547 } )
4648
You can’t perform that action at this time.
0 commit comments