Adding _cid, _gid and session_id registration in the before() middleware