check and use X-Real-IP

This commit is contained in:
Dan Ballard 2020-09-27 19:22:05 -07:00
parent 11590d2d5d
commit ad6bf412b4
1 changed files with 5 additions and 0 deletions

View File

@ -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)