koajs / koajs/koa

request.ip via x-forwarded-for should strip out ports

Open
#827 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
JavaScript
Stars
35.7k
Forks
3.2k
Avg merge
5d 6h
Merged PRs (30d)
2

Description

on azure (yes, i know), ports are also being sent as well as the ip in `x-forwarded-for`:

```
'x-forwarded-for': '23.243.1.1:38242'
```

`request.ip` should not return the port section. aye or nay?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the request.ip entry point and trace how the x-forwarded-for header is parsed. Reproduce the Azure-style value shown in the issue, then verify that request.ip excludes the port while preserving the client IP; no specific file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.