Skip to content

Commit 03a7078

Browse files
committed
[doc] Remove unsafe regex from code snippet
1 parent 7ee3115 commit 03a7078

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ the `X-Forwarded-For` header.
395395

396396
```js
397397
wss.on('connection', function connection(ws, req) {
398-
const ip = req.headers['x-forwarded-for'].split(/\s*,\s*/)[0];
398+
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
399399
});
400400
```
401401

0 commit comments

Comments
 (0)