Replace r.RemoteAddr with r.Header.Get("X-Forwarded-For")
This commit is contained in:
parent
ecf4c73f4b
commit
02fc36f723
1 changed files with 2 additions and 4 deletions
|
@ -1,7 +1,6 @@
|
|||
package orm
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -54,12 +53,11 @@ func (um UserModifier) UpdatedBy() *User {
|
|||
func WriteCreator(r *http.Request, modifier Modifier) {
|
||||
modifier.SetCreatorID(getUserIDFromTokenAsUint(r))
|
||||
modifier.SetCreatorRole(getUserRole(r))
|
||||
modifier.SetCreatorIP(r.RemoteAddr)
|
||||
modifier.SetCreatorIP(r.Header.Get("X-Forwarded-For"))
|
||||
}
|
||||
|
||||
func WriteUpdater(r *http.Request, modifier Modifier) {
|
||||
modifier.SetUpdaterID(getUserIDFromTokenAsUint(r))
|
||||
modifier.SetUpdaterRole(getUserRole(r))
|
||||
modifier.SetUpdaterIP(r.RemoteAddr)
|
||||
log.Printf("Forwarded IP address: %v", r.Header.Get("X-Forwarded-For"))
|
||||
modifier.SetUpdaterIP(r.Header.Get("X-Forwarded-For"))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue