File tree 2 files changed +7
-2
lines changed
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) {
1326
1326
// https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
1327
1327
request . headersList . delete ( 'authorization' , true )
1328
1328
1329
+ // https://fetch.spec.whatwg.org/#authentication-entries
1330
+ request . headersList . delete ( 'proxy-authorization' , true )
1331
+
1329
1332
// "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
1330
1333
request . headersList . delete ( 'cookie' , true )
1331
1334
request . headersList . delete ( 'host' , true )
Original file line number Diff line number Diff line change @@ -7,11 +7,12 @@ const { once } = require('node:events')
7
7
const { fetch } = require ( '../..' )
8
8
9
9
test ( 'Cross-origin redirects clear forbidden headers' , async ( t ) => {
10
- const { strictEqual } = tspl ( t , { plan : 5 } )
10
+ const { strictEqual } = tspl ( t , { plan : 6 } )
11
11
12
12
const server1 = createServer ( ( req , res ) => {
13
13
strictEqual ( req . headers . cookie , undefined )
14
14
strictEqual ( req . headers . authorization , undefined )
15
+ strictEqual ( req . headers [ 'proxy-authorization' ] , undefined )
15
16
16
17
res . end ( 'redirected' )
17
18
} ) . listen ( 0 )
@@ -40,7 +41,8 @@ test('Cross-origin redirects clear forbidden headers', async (t) => {
40
41
const res = await fetch ( `http://localhost:${ server2 . address ( ) . port } ` , {
41
42
headers : {
42
43
Authorization : 'test' ,
43
- Cookie : 'ddd=dddd'
44
+ Cookie : 'ddd=dddd' ,
45
+ 'Proxy-Authorization' : 'test'
44
46
}
45
47
} )
46
48
You can’t perform that action at this time.
0 commit comments