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 @@ -1203,6 +1203,9 @@ function httpRedirectFetch (fetchParams, response) {
1203
1203
// https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
1204
1204
request . headersList . delete ( 'authorization' )
1205
1205
1206
+ // https://fetch.spec.whatwg.org/#authentication-entries
1207
+ request . headersList . delete ( 'proxy-authorization' , true )
1208
+
1206
1209
// "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
1207
1210
request . headersList . delete ( 'cookie' )
1208
1211
request . headersList . delete ( 'host' )
Original file line number Diff line number Diff line change @@ -6,11 +6,12 @@ const { once } = require('events')
6
6
const { fetch } = require ( '../..' )
7
7
8
8
test ( 'Cross-origin redirects clear forbidden headers' , async ( t ) => {
9
- t . plan ( 5 )
9
+ t . plan ( 6 )
10
10
11
11
const server1 = createServer ( ( req , res ) => {
12
12
t . equal ( req . headers . cookie , undefined )
13
13
t . equal ( req . headers . authorization , undefined )
14
+ t . equal ( req . headers [ 'proxy-authorization' ] , undefined )
14
15
15
16
res . end ( 'redirected' )
16
17
} ) . listen ( 0 )
@@ -39,7 +40,8 @@ test('Cross-origin redirects clear forbidden headers', async (t) => {
39
40
const res = await fetch ( `http://localhost:${ server2 . address ( ) . port } ` , {
40
41
headers : {
41
42
Authorization : 'test' ,
42
- Cookie : 'ddd=dddd'
43
+ Cookie : 'ddd=dddd' ,
44
+ 'Proxy-Authorization' : 'test'
43
45
}
44
46
} )
45
47
You can’t perform that action at this time.
0 commit comments