overleaf/patches/forwarded+0.2.0.patch
Jakob Ackermann f60e86a71d Merge pull request #12989 from overleaf/jpa-req-socket-null
[misc] add patches for gracefully handling missing req.socket/connection

GitOrigin-RevId: fd0b067d5a4b5a96857ac94a577460b82bba7672
2023-05-10 08:05:07 +00:00

13 lines
415 B
Diff

diff --git a/node_modules/forwarded/index.js b/node_modules/forwarded/index.js
index b2b6bdd..75e6254 100644
--- a/node_modules/forwarded/index.js
+++ b/node_modules/forwarded/index.js
@@ -46,7 +46,7 @@ function forwarded (req) {
function getSocketAddr (req) {
return req.socket
? req.socket.remoteAddress
- : req.connection.remoteAddress
+ : req.connection && req.connection.remoteAddress
}
/**