The session is stored on the server side, and a session cookie is created on the client side to identify the current browser session that contains the current session identifier.
The session cookie is based on the domain that you use to access the site.
Since you are using a different domain, this is localhost and the other is ip , which will create two different sessions.
When visiting pages through the localhost domain. It will create a session and save the session cookie in the localhost domain. If you visit another page on the same domain system, check if the session cookie exists, it resumes the old session and does not create a new one.
At the same time, if you access via ip , the session cookie is not saved for that ip , and then the system assumes that there is no active session for this user, and he will start a new session, and the session cookie will be saved for based on this ip .
This is how the session works.
Hope this helps.
source share