Get the truth of the user IP

HTTP X-Forwarded-For

Currently, only HTTPtype agents support this feature and can be accessed through user requests X-Forwarded Forin the header to get the truth of The user IP is enabled by default.

Proxy Protocol

FRP supports passing through FRP through theProxy Protocolprotocol The real IP address of the Agent's request, which supports all requests over TCP The type of underlying protocol does not support UDP.

Proxy ProtocolAfter enabling the function, frpc After establishing a connection with the local service, a segment will be sent first Proxy Protocol Provide the protocol content to the local service, and the local service can obtain the true identity of the visiting user by parsing this content IP. So it's not just HTTP services, any TCP Service, as long as this protocol is supported, can obtain the user's real IP address.

It should be noted that in the Agent To enable this feature in Configuration, local services need to be able to support it Proxy ProtocolThis protocol currently includes nginx and haproxy They can all be well supported.

TakingHTTPStype as an example:

# frpc.toml
    [[proxies]]
    name = "web"
    type = "https"
    localPort = 443
    customDomains = ["test.yourdomain.com"]
    
    # Two versions of proxy protocol, v1 and v2, are currently supported.
    transport.proxyProtocolVersion = "v2"
    

Just add one line in Agent Configuration transport. proxyProtocolVersion="a; V2"a This function can be activated.

The local HTTPS service can be enabled in nginx's Configuration Parse Proxy Protocol and set the result to X-Real IPThis header can be found on your own web Obtain the user's real IP address throughX-Real IPin the service.

Last modified November 15, 2023: fix 404 (#71) (626ce4d)