douyu8187
2014-12-01 18:31
浏览 2.3k
已采纳

从http.Request获取客户端IP地址的正确方法

What's the correct way to get all client's IP Addresses from http.Request? In PHP there are a lot of variables that I should check. Is it the same on Go?

One that I found is:

req.RemoteAddr

And is the request case sensitive? for example x-forwarded-for is the same as X-Forwarded-For and X-FORWARDED-FOR? (from req.Header.Get("X-FORWARDED-FOR"))

4条回答 默认 最新

相关推荐 更多相似问题