Springboot server can't get a cookie domain, it get cookie object though

Viewed 168

In Java 17, Springboot 2.x.

I'm using 2 servers that one is simba.com and another is using cute.simba.com what is subdomain.

I'm developing a method what can delete simba.com cookie and cute.simba.com cookie.

However, i can catch both cookies in the controller but i can't get domain of them. It just seems 'null' value.

I don't understand why those cookies don't contain domains, i created its with domain though.

This is source what get cookies in the Controller.

    public static void deleteCookie(HttpServletRequest request, HttpServletResponse response) {
        Cookie[] cookies = request.getCookies();
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                cookie.setValue(null);
                cookie.setMaxAge(0);
                response.addCookie(cookie);
            }
        }
     }

Created cookie with domain.

enter image description here

Debugging to values of Cookie

enter image description here

0 Answers
Related