From: Óliver García Albertos <3skuero@gmail.com> Date: Thu, 22 Jun 2023 07:34:51 +0000 (+0100) Subject: logger: Use forwarded instead of peer IP address (#3223) X-Git-Url: http://these/git/%22https:/nerdica.net/%7B%24%7B%60data:application/%7BlocalRss%7D?a=commitdiff_plain;h=985359918f43234892f83d4b1de3116252cc9199;p=lemmy.git logger: Use forwarded instead of peer IP address (#3223) --- diff --git a/src/lib.rs b/src/lib.rs index 1bc00f70..f6ca7954 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -165,7 +165,10 @@ pub async fn start_lemmy_server() -> Result<(), LemmyError> { }; App::new() - .wrap(middleware::Logger::default()) + .wrap(middleware::Logger::new( + // This is the default log format save for the usage of %{r}a over %a to guarantee to record the client's (forwarded) IP and not the last peer address, since the latter is frequently just a reverse proxy + "%{r}a '%r' %s %b '%{Referer}i' '%{User-Agent}i' %T", + )) .wrap(cors_config) .wrap(TracingLogger::::new()) .app_data(Data::new(context))