Q: Cookie is deleted locally but not when deployed I'm trying to invalidate a cookie created by my code. I want to do this creating a new endpoint to logout. I have to choose between two paths to redirect depending on whether an endpoint returns data or not. When I run the code locally it works like a charm. Deletes the cookie and redirects to the correct url but, if I test it deployed on a remote server, it doesn't work, meaning that it redirects correctly but doesn't expire the cookie nor modifies its value. My whole code must be a back end one so i cannot redirect to a javascript that would delete the cookie and redirect again.
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public void cookieKiller(
        @CookieValue(name = "theCookie", required = false) Cookie myCookie,
        HttpServletResponse response, HttpServletRequest request) {


    if (myCookie != null) {
    } else { // Just being cautious, if the cookie is not retrieved, would be overwritten anyway just in case
        myCookie = new Cookie("theCookie","");
    }
    myCookie.setMaxAge(0);
    myCookie.setValue("");
    myCookie.setPath("/");
    response.addCookie(myCookie);

    boolean endpointHealthy = true;

    if(haveITheEndpointUrls()) {
        endpointHealthy = false;
    } else {
        try {
            String eaiResponseJson = restTemplateAutowired.getForEntity(new URI(oneUrl),String.class).getBody();

            if (eaiResponseJson != null && !eaiResponseJson.isBlank()) {
                response.sendRedirect(eaiSamlUrl);
            } else {
                endpointHealthy = false;
            }

        } catch (IOException e) {
            endpointHealthy = false;
        } catch (ResourceAccessException e) {
            endpointHealthy = false;
        } catch (HttpClientErrorException e) {
            endpointHealthy = false;
        } catch (Exception e) {
            endpointHealthy = false;
        }
    }

    if (!endpointHealthy) {
        try {
            response.sendRedirect(request.getContextPath() + "/internal/Path");
        } catch (IOException ex) {
            // ...
        }
    }

}

If I add a new cookie, the domain that is generated is different than the original one, introduced in the front part of the application. Being the back one "domain.com" and the front one ".domain.com" so I guess it's a domain thing
I've been trying to change the path, to change the value, etc, but it won't work either, i've surfed stackoverflow a lot in search for an answer but without any result. Some suggestion or clue about domains or any hint that i could've been missing?

A: My code in local was generating a cookie like domain.com but SHibboleth needs cookie domains starting with a dot. I tried to create a cookie this way but that was not possible in Tomcat unless you use a LegacyCookieManager.
