Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
13f95ee895 | |||
99c0137034 |
3
main.go
3
main.go
@ -119,7 +119,8 @@ func main() {
|
||||
r.Post("/reload", reloadHandler)
|
||||
r.Get("/dl_map", dlMapHandler)
|
||||
r.Get("/metrics", promhttp.Handler().ServeHTTP)
|
||||
r.HandleFunc("/*", redirectHandler)
|
||||
|
||||
r.NotFound(redirectHandler)
|
||||
|
||||
go http.ListenAndServe(viper.GetString("bind"), r)
|
||||
|
||||
|
@ -29,7 +29,9 @@ func RealIPMiddleware(f http.Handler) http.Handler {
|
||||
return
|
||||
}
|
||||
|
||||
if !net.ParseIP(host).IsPrivate() {
|
||||
netIP := net.ParseIP(host)
|
||||
|
||||
if !netIP.IsLoopback() && !netIP.IsPrivate() {
|
||||
f.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user