logger: Use forwarded instead of peer IP address (#3223)
This commit is contained in:
parent
ef3544bac4
commit
985359918f
1 changed files with 4 additions and 1 deletions
|
@ -165,7 +165,10 @@ pub async fn start_lemmy_server() -> Result<(), LemmyError> {
|
||||||
};
|
};
|
||||||
|
|
||||||
App::new()
|
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(cors_config)
|
||||||
.wrap(TracingLogger::<QuieterRootSpanBuilder>::new())
|
.wrap(TracingLogger::<QuieterRootSpanBuilder>::new())
|
||||||
.app_data(Data::new(context))
|
.app_data(Data::new(context))
|
||||||
|
|
Loading…
Reference in a new issue