File tree 2 files changed +14
-7
lines changed
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " proxy " : patch
3
+ ---
4
+
5
+ Ensure that ` socket.remoteAddress ` is a string
Original file line number Diff line number Diff line change @@ -116,12 +116,14 @@ async function onrequest(
116
116
// append to existing "X-Forwarded-For" header
117
117
// http://en.wikipedia.org/wiki/X-Forwarded-For
118
118
hasXForwardedFor = true ;
119
- value += ', ' + socket . remoteAddress ;
120
- debug . proxyRequest (
121
- 'appending to existing "%s" header: "%s"' ,
122
- key ,
123
- value
124
- ) ;
119
+ if ( typeof socket . remoteAddress === 'string' ) {
120
+ value += ', ' + socket . remoteAddress ;
121
+ debug . proxyRequest (
122
+ 'appending to existing "%s" header: "%s"' ,
123
+ key ,
124
+ value
125
+ ) ;
126
+ }
125
127
}
126
128
127
129
if ( ! hasVia && 'via' === keyLower ) {
@@ -151,7 +153,7 @@ async function onrequest(
151
153
152
154
// add "X-Forwarded-For" header if it's still not here by now
153
155
// http://en.wikipedia.org/wiki/X-Forwarded-For
154
- if ( ! hasXForwardedFor ) {
156
+ if ( ! hasXForwardedFor && typeof socket . remoteAddress === 'string' ) {
155
157
headers [ 'X-Forwarded-For' ] = socket . remoteAddress ;
156
158
debug . proxyRequest (
157
159
'adding new "X-Forwarded-For" header: "%s"' ,
You can’t perform that action at this time.
1 commit comments
vercel[bot] commentedon May 18, 2023
Successfully deployed to the following URLs:
proxy-agents – ./
proxy-agents.vercel.app
proxy-agents-git-main-tootallnate.vercel.app
proxy-agents-tootallnate.vercel.app