session not shared between two server

2019-04-01 01:32发布

问题:

i have big trouble with my application that web-application(jsp,java,servlet) landed between two server cause there is load-sharing between server but unfortunately session not maintaining between server now i am checking checking after login if session is there than ok otherwise i am taking all credential from url (visible encoded url with same key if somebody remember url then big mess ) obviously its not secure at all ,SO how we can resolve this problame at application level please guide me.......

回答1:

You have two options:

  • sticky session - once some user hits one server, load balancer makes sure she will always use the exact same server.

  • session replication - every change in HTTP session is migrated to another nodde in the cluster. Load balancer remains unaffected.

Both approaches are configuration only, no changes to your application are required.