Accidentally referred to response headers, not request headers, when determining IP address

This commit is contained in:
Seednode 2022-12-20 17:54:27 -06:00
parent 3d560ef770
commit af9def38ba
2 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var Version = "0.28.0" var Version = "0.28.1"
func init() { func init() {
rootCmd.AddCommand(versionCmd) rootCmd.AddCommand(versionCmd)

View File

@ -294,8 +294,8 @@ func serveStaticFile(w http.ResponseWriter, r *http.Request, paths []string) err
if Verbose { if Verbose {
remoteAddr := "" remoteAddr := ""
cfIP := w.Header().Get("Cf-Connecting-Ip") cfIP := r.Header.Get("Cf-Connecting-Ip")
xRealIp := w.Header().Get("X-Real-Ip") xRealIp := r.Header.Get("X-Real-Ip")
if cfIP != "" { if cfIP != "" {
remoteAddr = cfIP remoteAddr = cfIP
} else if xRealIp != "" { } else if xRealIp != "" {