Skip to content
Merged
Changes from 1 commit
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 @@ -41,11 +41,11 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
String deviceId = resolveDeviceId(httpRequest);
if (deviceId == null) {
deviceId = deviceIdGenerator.generate();
Cookie cookie = new Cookie(COOKIE_NAME, deviceId);
cookie.setHttpOnly(true);
cookie.setPath("/");
cookie.setMaxAge(cookieMaxAge);
httpResponse.addCookie(cookie);
String cookieHeader = String.format(
"%s=%s; Path=/; Max-Age=%d; HttpOnly; SameSite=Lax; Secure",
COOKIE_NAME, deviceId, cookieMaxAge
);
httpResponse.addHeader("Set-Cookie", cookieHeader);
log.debug("[DeviceId] 신규 발급 ip={} deviceId={}",
httpRequest.getAttribute(ClientIpFilter.CLIENT_IP_ATTRIBUTE), deviceId);
}
Expand All @@ -55,6 +55,9 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
}

private boolean isLikesPath(HttpServletRequest request) {
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
return false;
}
String uri = request.getRequestURI();
return uri.matches(".*/booths/[^/]+/likes$");
}
Expand Down
Loading