mirror of
https://github.com/yusing/godoxy.git
synced 2025-07-17 10:24:03 +02:00
"visitor" prometheus metric
This commit is contained in:
parent
28d4373f67
commit
a9f6c4eb20
1 changed files with 2 additions and 2 deletions
|
@ -275,11 +275,11 @@ func (p *ReverseProxy) handler(rw http.ResponseWriter, req *http.Request) {
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
var visitor string
|
var visitor string
|
||||||
if realIPs := req.Header.Values("X-Real-IP"); len(realIPs) > 0 {
|
if realIPs := req.Header.Values("X-Real-IP"); len(realIPs) > 0 {
|
||||||
visitor = realIPs[len(realIPs)-1]
|
visitor = realIPs[0]
|
||||||
}
|
}
|
||||||
if visitor == "" {
|
if visitor == "" {
|
||||||
if fwdIPs := req.Header.Values("X-Forwarded-For"); len(fwdIPs) > 0 {
|
if fwdIPs := req.Header.Values("X-Forwarded-For"); len(fwdIPs) > 0 {
|
||||||
visitor = fwdIPs[len(fwdIPs)-1]
|
visitor = fwdIPs[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if visitor == "" {
|
if visitor == "" {
|
||||||
|
|
Loading…
Add table
Reference in a new issue