When you configure <session-cookie/> with a domain name, the Set-Cookie header of a given server response will contain a session cookie with a domain.
However, when sending a request, your browser will only send cookies with a matching domain.
That is why requests send to an IP address always start a new session.
Generally, you do not need/want to specify a domain in your session cookie.
In this case, response from the server will contain a Set-Cookie without any domain causing the browser to auto-apply an effective domain based on the request.
If the request was made using an IP address, the effective domain of the cookie will be that IP address.