Я пытаюсь установить файл cookie httponly с приведенным ниже кодом
Код: Выделить всё
public static void setCookie(HttpServletResponse response,
String cookieName,
String cookieValue,
String path,
int maxAge) {
if (StringUtils.isNoneEmpty(cookieName, cookieValue)) {
Cookie cookie = new Cookie(cookieName, cookieValue);
cookie.setMaxAge(maxAge);
cookie.setPath(path);
cookie.setSecure(true);
cookie.setHttpOnly(true);
response.addCookie(cookie);
}
}
Код: Выделить всё
x-sny-remembermeexp=2024-05-16T20:18:08.127731+02:00; Max-Age=604800; Expires=Thu, 16 May 2024 18:18:08 GMT; Path=/; HttpOnlybe; Secure; HttpOnly
Проверка заголовка ответа после добавления файла cookie показывает, что заголовок имеет вид Я этого ожидал
Код: Выделить всё
x-sny-isrememberme=true; Max-Age=604800; Expires=Thu, 16 May 2024 18:18:08 GMT; Path=/be; Secure; HttpOnly
Подробнее здесь: https://stackoverflow.com/questions/784 ... w-httponly