Home > other >  Consult Nginx proxy Cookie lost how to solve
Consult Nginx proxy Cookie lost how to solve

Time:04-21

Business scenarios are currently two do single sign-on system, implementation of the building Lord are communal cookie, but because the two systems in different servers, causing local run very normal demo on actual different IP server met cookie cross-domain problem, want to use one nginx proxy server address for a visit, but checked with cookies or can't share, the net parameters using proxy_cookie_path transformation was carried out on the path but nginx -s reload is always an error

My broker configuration is as follows:

I tried to modify the local Host, map under the two systems to a domain level 3 domains respectively, and the secondary domain name, sharing the cookie is allowed, but the actual environment in which a need external mapping to the Internet, so it doesn't work, other such as redis for sharing session, oauth2 framework to realize single sign-on might not consider for time reason, also, every brother please help and see where the problem is now

CodePudding user response:

The backend implementation, system A to system B comes after login sessionId as cookies to jump B system, but because the cross-domain cause cookies can't pass in the past,
 cookies cokie=new Cookie (" JSESSIONID_SHIRO, "sessionId); 
Cokie. SetDomain (domain);
Cokie. SetPath (/);
The response addCookie (cokie);
+ path response. SendRedirect (" http://192.168.101.4:8080/window/");
  • Related