I ran two identical services, both using gin

http://172.12.0.62:8080 http://172.12.0.62:8082

Use cookies to manage sessions

c.SetCookie(SESSION_USER_ID_KEY, userID, int(60*60), SESSION_PATH, "", false, true)

But I found that the cookies of the two sites affect each other。 Where do I have a problem setting?

thanks

Comment From: sasidharansd

Hey @hackersean, as the domain of the both the service url is same ( 172.12.0.62) , even if the subdomain is different, it is a default browser behaviour to treat it as a same site and share the cookies.

Comment From: kaylee595

Both sites have the same IP address, and the cookies are shared with each other, even if they have different ports. If you want to keep the cookies from interfering with each other, you can use a domain name instead, by writing the domain name to the host and pointing it to the same IP address.