Skip to content

Commit 51fcacc

Browse files
committed
fixup
1 parent 656c28c commit 51fcacc

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

examples/proxy/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async function run () {
1919
for (const name of res.getHeaderNames()) {
2020
res.removeHeader(name)
2121
}
22-
res.writeHead(err.statusCode || 500)
22+
res.statusCode = err.statusCode || 500
2323
res.end()
2424
}
2525
})

examples/proxy/proxy.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ function getHeaders ({
213213
`proto=${socket.encrypted ? 'https' : 'http'}`,
214214
`host=${printIp(authority || host || '')}`
215215
].join(';'))
216-
} else {
217-
result.push('forwarded', forwarded)
216+
} else if (forwarded) {
217+
// The forwarded header should not be included in response.
218+
throw new createError.BadGateway()
218219
}
219220

220221
if (httpVersion && proxyName) {

0 commit comments

Comments
 (0)