/usr/local/cellar/go/1.5.1/libexec/src/
Where is his remoteaddr obtained?
Func (c *conn) remoteaddr () Addr {if!c.ok () {return Nil}return c.fd.raddr}
The use of the remote address of the Nginx agent is not correct, both 127.0.0.1, the solution needs to configure Nginx
Server {Listen the; server_name localhost; Location/{root HTML; Index index.html index.htm; Proxy_pass http://backend;Proxy_redirect off; Proxy_set_header Host $host; Proxy_set_header X-real-IP $remote _addr; Proxy_set_header X-forwarded-For $proxy _add_x_forwarded_for; # Proxy_set_header X-forwarded-For $http _x_forwarded_for; } scenario 1nginx here is an assignment operation, as follows: Proxy_set_header X-real-IP $remote _addr, where this x-REAL-IP is a custom variable name, the name can be arbitrarily taken, so that after the user's real IP is placed in the variable X-real-ip, and then, on the web side can be obtained:
The previous head map has
map[user-agent:[apache-httpclient/4.2.6 (Java 1.5)] connection:[keep-alive] Content-type:[application/json] Accept-encoding:[gzip] content-length:[99]
After adding the configuration, there is
: Map[connection:[close] content-length:[99] Content-type:[application/json] Accept-encoding:[gzip] User-Agent:[ apache-httpclient/4.2.6 (Java 1.5)] x-real-ip:[192.168.100.103] x-forwarded-for:[192.168.100.103]
Where does the Go language library file be placed? How to get the remote address correctly after using Nginx proxy