Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] metric 사용시 로깅을 사용하지 않는 로직 추가, favicon.ico 요청 허용 #316

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public SecurityFilterChain filterChain(final HttpSecurity http) throws Exception
.requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
.requestMatchers(ACTUATOR).permitAll()
.requestMatchers(METRICS).permitAll()
.requestMatchers(FAVICON_URL).permitAll()
.requestMatchers(API_V_1 + "oauth/login").permitAll()
.requestMatchers(API_V_1 + "oauth/logout").authenticated()
.requestMatchers(API_V_1 + "oauth/reissue").permitAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class LoggingFilter extends OncePerRequestFilter {
private static final String PARAM_DELIMITER = "&";
private static final String KEY_VALUE_DELIMITER = "=";

private static final String METRIC_URL_PREFIX = "/actuator";
private static final String FAVICON_URL = "/favicon.ico";

private final StopWatch apiTimer;
private final ApiQueryCounter apiQueryCounter;

Expand All @@ -47,6 +50,10 @@ protected void doFilterInternal(final HttpServletRequest request,
final FilterChain filterChain) throws ServletException, IOException {
final ContentCachingRequestWrapper cachingRequest = new ContentCachingRequestWrapper(request);
final ContentCachingResponseWrapper cachingResponse = new ContentCachingResponseWrapper(response);
final String requestURI = cachingRequest.getRequestURI();
if (requestURI.contains(METRIC_URL_PREFIX) || requestURI.contains(FAVICON_URL)) {
return;
}

apiTimer.start();
filterChain.doFilter(cachingRequest, cachingResponse);
Expand Down
Loading