'Cookies not getting deleted on production server but works on localhost

I have following code snippet which deletes the cookie for the current domain.

login(isRedirect) {
    this.spinner.show();
    this.auth.loginUser({ shopId: -1, tillNumber: -2 })
        .subscribe((response: any) => {
            if (response && response.responseCode && response.redirectUrl && response.responseCode === 302 && isRedirect) {
                window.location.href = response.redirectUrl;
            } else if (response && response.posSessionId) {
                this.router.navigate(['/']);
                this.toastr.success('Logged in!');
            } else {
                this.cookie.deleteAll('/', config.COOKIE_DOMAIN)
            }
            this.spinner.hide();
        }, err => {
            this.spinner.hide();
        });
}

It work fine on localhost but doesnt work on when i push the code to server and access the site on production url.

value of COOKIE_DOMAIN is ".testServer.com"
My localhost is on http://localhost.testServer.com:4200/
My production server is on https://origin-merchant.testServer.com

FYI: The cookie delete logic works fine when I open production site on firefox but not on chrome.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source