mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #4184] [Feature Request] Make client IP accessible to upstream by spoofing source IP #3295
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#3295
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dong-zeyu on GitHub (Apr 27, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4184
Describe the feature request
As a reverse proxy, FRP currently supports two ways for the upstream server to obtain the client's real IP: HTTP X-Forwarded-For and Proxy Protocol. The former only supports HTTP protocol and the latter supports generic TCP connection but would require support for uptream. My current solution for upstreams that do not support proxy protocol is to use mmproxy or go-mmproxy to wrap the bare TCP with the proxy protocol. However, this requires configuring additional programs and upstream ports and also introduces overhead to copy data between the processes.
Describe alternatives you've considered
The underlying technology that mmproxy uses is TPROXY supported by the Linux kernel. This can be easily implemented in Go by a few lines of code (I referred to go-mmproxy)
saddris the remote client address obtained from the FRP server. Then the upstream will be connected as if it is directly connected from the IP address of the remote client.By doing so, the FRP client would support spoofing the client IP to the upstream out-of-box, without further configuration to the upstream or running additional programs.
However, this functionality still has certain limitations: first, this would only work on the Linux system as far as I know; second, configurations to the Linux firewall/routing is still needed (these configurations are global and do not need to be set separately for each service); third,
CAP_NET_ADMINcapability is required to setIP_TRANSPARENTsocket opt.I have a simple PoC for this feature in my fork, but maybe more work is needed to make it into the FRP.
Affected area
@fatedier commented on GitHub (Apr 28, 2024):
This is one of the reasons we were not too keen on introducing related features before.
Currently, it may be a wiser choice to combine more professional tools.
I hope to see more practical demand scenarios. Changes in this area will only be considered after we have made progress in the refactoring and optimization of our core architecture.
@crabdancing commented on GitHub (Aug 25, 2024):
One reason this feature is potentially important is that the company I work for is interested in localizing the TLS encryption to the backend server, with the less trusted proxy essentially functioning as a dumb pipe.
@JustKeonix commented on GitHub (Apr 7, 2025):
Another use case is allowing for client ban/rate limiting/load balancing by source IP for UDP upstreams (voice chat, video conferencing, game servers e.t.c.). Are there any alternative tools having this functionality?
@fsj2009yx commented on GitHub (Aug 24, 2025):
perhaps it can join as a client plugin,based on go-mmproxy subprocess
@fatedier commented on GitHub (Aug 25, 2025):
This is one of the important directions we are considering for the future — supporting more extensibility. We are unable to devote sufficient effort to maintaining all kinds of complex requirements within a single project.
However, this may require some refactoring of the existing code architecture and design. This is also part of the vision for the next major version, but it will take time — it’s not that simple.
@Deng-Xian-Sheng commented on GitHub (Oct 4, 2025):
You should pay the author, like $1000, so that the author has the motivation to write new features during his sleep time, hahahaha