Session: New ID generated every time, can't load existing ID from URL

I have a problem. My frontend is in one domain and my backend is in another domain.

When calling the backend, a new session ID is generated every time. I assume it’s because the backend is in a different domain and the browser is not sending the PHP cookie PHPSESSID.

So I’m trying to manually send the PHPSESSID in the URL and load it in the backend:

    $query = $request->getQueryParams();
    $smgr = $this->sessionManager;
    if ($smgr->sessionExists()) {
        if ($smgr->getId() !== $query['PHPSESSID']) {
    $sc = new Laminas\Session\Container();

However, the session data is not loaded. How can I make it load the existing data in another session ID?

I checked and the session file saved by PHP contains the data I expect:

$ cat /var/lib/php/sessions/sess_vnd69t0fv5kffsp8beiqg6s8q2

One workaround I found now is this: Disabling session.use-only-cookies in php.ini

In session config you set cookie_secure is false