Skip to content

forwardedFor

Modify the x-forwarded-for request header field to customize the client IP address.

Rule Syntax

txt
pattern forwardedFor://ip [filters...]
ParametersDescriptionDetailed Documentation
patternExpression to match request URLsMatch Pattern Documentation
ipCustom client IP
⚠️ Loading data from files/remote URLs is not supported
filtersOptional filters, supports matching:
• Request URL/Method/Headers/Content
• Response Status Code/Headers
Filter Documentation

Configuration Example

txt
# Setting a fixed IP address
www.example.com/path forwardedFor://1.1.1.1

# Using the real client IP address (transparent mode)
www.example.com forwardedFor://`${clientIp}`

Associated Protocols

  1. Directly modify the request header: reqHeaders://x-forwarded-for=value (the value in this method is not limited to the IP address)
  2. Enable automatic x-forwarded-for: enable://clientIp