Skip to content

X-Forwarded-SourcePort (or similar) needed #9298

@mrambossek

Description

@mrambossek

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you expect to see?

i posted this on the forum as well: https://community.traefik.io/t/x-forwarded-sourceport-or-similar/15608

tl;dr: i need a way of forwarding info about the source TCP port of the http request to a server behind a http router via an http header, for example, X-Forwarded-SourcePort.

a good chunk of the internet these days is behind CGN (Carrier Grade NAT), meaning that the IP traefik sees, is not directly traceable to the actual client. what that means is that if you have an abuse case - maybe someone hacked your outdated wordpress? - to be able to do anything at all, you have to provide the ISP with a) a timestamp b) the (real) source IP and crucially c) the source TCP port of the request, because the way CGN typically works is that it assigns "blocks of ports" to a subscriber, and then uses ports out of that block until it is depleted, and only these blocks are logged, not individual connections.

ie subscriber A's CPE has the WAN IP 100.123.123.123, at 12:00:00 gets assigned ports range 10500-10600, and the offending HTTP request uses port 10527 out of that block - this is logged in the ISPs CGN database.

for the ISP to be able to trace this to an actual customer, they need all 3 pieces of information.
in bare nginx, you can use $remote_port in your logging definition to get the desired effect; but as far as i can see, there is no way to communicate it through X- headers .. so far?

i am not a developer, more like a scripting sysadmin, so i'm definitely not the best person to try and implement this. from looking at the source, i would guess that it should go around here somewhere:
pkg/middlewares/forwardedheaders/forwarded_header.go#L113

i would further guess that this is not a HUGE deal technically, more from a design/"how should we do this properly" decision perspective :)

any help would be greatly appreciated,
thanks & regards

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions