Skip to content

Commit

Permalink
docs: application-prod.properties 파일 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
sakjung committed Mar 13, 2023
1 parent f3e6be8 commit 4deabd6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3,663 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void afterRequest(final ContentCachingRequestWrapper request,
(reqBody) -> logMsgBuilder.append("[REQUEST BODY: ").append(reqBody).append("] "));

appendIfNotBlank(request.getRemoteAddr(),
(remoteAddr) -> logMsgBuilder.append("[REMOTE ADDRESS: ").append(request.getRemoteAddr()).append("] "));
(remoteAddr) -> logMsgBuilder.append("[REMOTE ADDRESS: ").append(getRemoteAddress(request)).append("] "));

appendIfNotBlank(new String(response.getContentAsByteArray(), response.getCharacterEncoding()),
(resBody) -> {
Expand Down Expand Up @@ -131,6 +131,15 @@ private void appendIfNotEmpty(final Map<?, ?> value, final Consumer<Map<?, ?>> a
}
}

private String getRemoteAddress(final ContentCachingRequestWrapper request) {
String xForwardedFor = request.getHeader("X-Forwarded-For");
if(StringUtils.isBlank(xForwardedFor)) {
return request.getRemoteAddr();
}
String clientIp = StringUtils.substringBefore(xForwardedFor, ",");
return StringUtils.trim(clientIp);
}

private void removeMDCInfo() {
MDC.remove("traceId");
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/resources/config
Loading

0 comments on commit 4deabd6

Please sign in to comment.