We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 59454e8 commit 33ab965Copy full SHA for 33ab965
1 file changed
main.go
@@ -38,9 +38,12 @@ func redirect(w http.ResponseWriter, req *http.Request) {
38
if len(req.URL.RawQuery) > 0 {
39
target += "?" + req.URL.RawQuery
40
}
41
- log.Printf("redirect to: %s from: %s", target, req.RemoteAddr)
42
- http.Redirect(w, req, target,
43
- http.StatusTemporaryRedirect)
+ if xff := req.Header.Get("X-Forwarded-For"); xff != "" {
+ log.Printf("redirect to: %s from: %s xff %s", target, req.RemoteAddr, xff)
+ } else {
44
+ log.Printf("redirect to: %s from: %s", target, req.RemoteAddr)
45
+ }
46
+ http.Redirect(w, req, target, http.StatusTemporaryRedirect)
47
48
49
func main() {
0 commit comments