diff --git a/src/main/java/org/kakaoshare/backend/common/config/SecurityConfig.java b/src/main/java/org/kakaoshare/backend/common/config/SecurityConfig.java index 7cc2850d..5e96b6e1 100644 --- a/src/main/java/org/kakaoshare/backend/common/config/SecurityConfig.java +++ b/src/main/java/org/kakaoshare/backend/common/config/SecurityConfig.java @@ -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() diff --git a/src/main/java/org/kakaoshare/backend/logging/filter/LoggingFilter.java b/src/main/java/org/kakaoshare/backend/logging/filter/LoggingFilter.java index ce1a2ec0..51469302 100644 --- a/src/main/java/org/kakaoshare/backend/logging/filter/LoggingFilter.java +++ b/src/main/java/org/kakaoshare/backend/logging/filter/LoggingFilter.java @@ -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; @@ -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);