diff --git a/backend/src/main/java/reviewme/global/RequestLimitInterceptor.java b/backend/src/main/java/reviewme/global/RequestLimitInterceptor.java index 61fee7477..75ad74567 100644 --- a/backend/src/main/java/reviewme/global/RequestLimitInterceptor.java +++ b/backend/src/main/java/reviewme/global/RequestLimitInterceptor.java @@ -1,7 +1,5 @@ package reviewme.global; -import static org.springframework.http.HttpHeaders.USER_AGENT; - import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.util.List; @@ -46,13 +44,12 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons private String generateRequestKey(HttpServletRequest request) { String requestURI = request.getRequestURI(); - String userAgent = request.getHeader(USER_AGENT); - String ip = PROXY_HEADERS.stream() + String remoteAddress = PROXY_HEADERS.stream() .map(request::getHeader) .filter(Objects::nonNull) .findFirst() .orElse(request.getRemoteAddr()); - return String.format("RequestURI: %s, IP: %s, UserAgent: %s", requestURI, ip, userAgent); + return String.format("RequestURI: %s, RemoteAddress: %s", requestURI, remoteAddress); } } diff --git a/backend/src/test/java/reviewme/global/RequestLimitInterceptorTest.java b/backend/src/test/java/reviewme/global/RequestLimitInterceptorTest.java index 8f8a6b69a..af0387a46 100644 --- a/backend/src/test/java/reviewme/global/RequestLimitInterceptorTest.java +++ b/backend/src/test/java/reviewme/global/RequestLimitInterceptorTest.java @@ -24,7 +24,7 @@ class RequestLimitInterceptorTest { private final ValueOperations valueOperations = mock(ValueOperations.class); private final RequestLimitProperties requestLimitProperties = mock(RequestLimitProperties.class); private final RequestLimitInterceptor interceptor = new RequestLimitInterceptor(redisTemplate, requestLimitProperties); - private final String requestKey = "RequestURI: /api/v2/reviews, IP: localhost, UserAgent: Postman"; + private final String requestKey = "RequestURI: /api/v2/reviews, RemoteAddress: localhost"; @BeforeEach void setUp() {