Skip to content

X-Forwarded-For doesn't properly handle ports #2789

@takeda

Description

@takeda

Initial Checks

  • I confirm this was discussed, and the maintainers suggest I open an issue.
  • I'm aware that if I created this issue without a discussion, it may be closed without a response.

Discussion Link

https://github.com/Kludex/uvicorn/discussions/2502

It was opened over a year ago, but it was ignored.

Description

The code currently ignores any ports provided in X-Forwarded-For and appends ":0":

Resulting entries like:

1.1.1.1:1024:0

Example Code

Python, Uvicorn & OS Version

Running uvicorn 0.40.0 with CPython 3.12.11 on Darwin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions