🐛 Fix cannot get ip behind cloudflare

This commit is contained in:
LittleSheep 2024-02-12 12:40:54 +08:00
parent 283a646eb4
commit 9a2192aa43
2 changed files with 2 additions and 0 deletions

View File

@ -29,6 +29,7 @@ func InitServer() *fiber.App {
ErrorHandler: status.StatusPageHandler, ErrorHandler: status.StatusPageHandler,
JSONDecoder: jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal, JSONDecoder: jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal,
JSONEncoder: jsoniter.ConfigCompatibleWithStandardLibrary.Marshal, JSONEncoder: jsoniter.ConfigCompatibleWithStandardLibrary.Marshal,
ProxyHeader: fiber.HeaderXForwardedFor,
Prefork: viper.GetBool("performance.prefork"), Prefork: viper.GetBool("performance.prefork"),
BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"), BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"),
}) })

View File

@ -23,6 +23,7 @@ func InitSideload() *fiber.App {
EnableIPValidation: true, EnableIPValidation: true,
JSONDecoder: jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal, JSONDecoder: jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal,
JSONEncoder: jsoniter.ConfigCompatibleWithStandardLibrary.Marshal, JSONEncoder: jsoniter.ConfigCompatibleWithStandardLibrary.Marshal,
ProxyHeader: fiber.HeaderXForwardedFor,
EnablePrintRoutes: viper.GetBool("debug.print_routes"), EnablePrintRoutes: viper.GetBool("debug.print_routes"),
TrustedProxies: viper.GetStringSlice("security.sideload_trusted_proxies"), TrustedProxies: viper.GetStringSlice("security.sideload_trusted_proxies"),
BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"), BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"),