check and use X-Real-IP
This commit is contained in:
parent
11590d2d5d
commit
ad6bf412b4
5
main.go
5
main.go
|
@ -60,6 +60,11 @@ func listen(listenPort, proxyPort int) {
|
|||
|
||||
func filter(res http.ResponseWriter, req *http.Request, listenPort, proxyPort int) {
|
||||
ip := req.RemoteAddr
|
||||
|
||||
if realIp := req.Header.Get("X-Real-IP"); realIp != "" {
|
||||
ip = realIp
|
||||
}
|
||||
|
||||
//log.Debugf("%v: Request %v %v\n", ip, req.Host, req.URL)
|
||||
cookie, err := req.Cookie("i_like_gogits")
|
||||
log.Debugf("ip: %v cookie: %v\n", ip, cookie)
|
||||
|
|
Loading…
Reference in New Issue