From 9a2192aa43fb85de4f5f5e9100f83c1b1f5304f7 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 12 Feb 2024 12:40:54 +0800 Subject: [PATCH] :bug: Fix cannot get ip behind cloudflare --- pkg/hypertext/server.go | 1 + pkg/sideload/server.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/hypertext/server.go b/pkg/hypertext/server.go index 27682f9..cf9c466 100644 --- a/pkg/hypertext/server.go +++ b/pkg/hypertext/server.go @@ -29,6 +29,7 @@ func InitServer() *fiber.App { ErrorHandler: status.StatusPageHandler, JSONDecoder: jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal, JSONEncoder: jsoniter.ConfigCompatibleWithStandardLibrary.Marshal, + ProxyHeader: fiber.HeaderXForwardedFor, Prefork: viper.GetBool("performance.prefork"), BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"), }) diff --git a/pkg/sideload/server.go b/pkg/sideload/server.go index 43c04a7..38adebb 100644 --- a/pkg/sideload/server.go +++ b/pkg/sideload/server.go @@ -23,6 +23,7 @@ func InitSideload() *fiber.App { EnableIPValidation: true, JSONDecoder: jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal, JSONEncoder: jsoniter.ConfigCompatibleWithStandardLibrary.Marshal, + ProxyHeader: fiber.HeaderXForwardedFor, EnablePrintRoutes: viper.GetBool("debug.print_routes"), TrustedProxies: viper.GetStringSlice("security.sideload_trusted_proxies"), BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"),