'Cookies in Google Chrome not created from time to time

Since few days I observed strange behaviour in Google Chrome connected with Cookies.

I have three environments:

  • HTTPS://somedomain.com (release env)
  • HTTP://dev.somedomain.com (development env)
  • HTTP://demo.somedomain.com (development env for demo)

Example: A. for development env. (HTTP://dev.somedomain.com and HTTP://demo.somedomain.com)

  • On Monday everything works fine
  • On Thursday Google Chrome removes session cookie "ci_session" (cookie disapeared) and webapp cannot regenerate it again anymore
  • When I clear Google Chrome browsing data everything back to normal but the situation repeats in couple days

B. for release env. (HTTPS://somedomain.com)

  • problem not exists
  • even If I manualy remove session cookie "ci_session" webapp regenerate it without problems

C. for local env (HTTP://localhost)

  • problem not exists
  • even If I manualy remove session cookie "ci_session" webapp regenerate it without problems

My comments:

It seems that the problem exists:

  • only in Google Chrome (not in Safari, Opera, Edge, Firefox)
  • only for HTTP and not for HTTPS protocol
  • OR/AND only for subdomain (but I am not sure if it is true)
  • exits for webapp installed on the internet (hosted server)
  • not exists when I run webapp localy installed on my PC development env.
  • problem occured on 2 different PCs with Win10 & Chrome

Please help:

  • Any ideas how to handle this issue?
  • Where to search the reason?
  • What I can check?
  • Any suggestion can be helpful

My configuration:

  • Windows 10
  • newest Google Chrome
  • Web app on hosting server (not local)
  • PHP 7.4
  • CogeIgniter 3.1.11
  • config.php:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 86400; //=24h (1h=3600)
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;


Sources

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

Source: Stack Overflow

Solution Source