-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About RemoteAddrPrivateSubnet #1567
Comments
Sure, you can look at Line 990 in 8e7bc60
It describes how to customize the configuration. That way you should get exactly what you want, you just have to create your own list. |
Here a Example: iris.WithConfiguration(iris.Configuration{
RemoteAddrPrivateSubnets: []netutil.IPRange{
{
Start: net.ParseIP("10.0.0.0"),
End: net.ParseIP("10.255.255.255"),
},
},
}), |
@kataras For local network users, the default value of "RemoteAddrPrivateSubnet" will cause incompatibility problem with version v12.1. |
@linanh These default values are the recommended to use on a typical web application. You can modify them with ease. Do you prefer to leave the default list as empty instead, what's your suggestion? Thanks |
@kataras In https://github.com/kataras/iris/blob/master/core/netutil/ip.go#L44, if a public IP address is not found, return the first IP address, and don't return false. |
@linanh The Lines 782 to 800 in a50f0ed
context.RemoteAddr can continue its job by fetching the address from Request.RemoteAddr , if non of the above passes. Look at: Lines 827 to 835 in a50f0ed
Your suggestion will break part of the However, if you really want to extract the IP from headers, even e non-public one and not from Request.RemoteAddr as fallback, we can add a UPDATE: Note that because of UPDATE: Upgrade to the latest master, add the $ cd your project
$ go get -u github.com/kataras/iris/v12@master Thanks, |
…ange RemoteAddrHeaders from map to string slice Read HISTORY.md entry
@kataras Thanks. |
You are welcome @linanh ! |
The config "RemoteAddrPrivateSubnet" variable is allowed to append, but not to be removed or set new.
For the users of local network, "ctx.RemoteAddr()" can only get proxy server ip, can't get real ip.
The text was updated successfully, but these errors were encountered: