cloudfoundry/gorouter — pull request #6 by michaljemala (2013-06-25 15:45:51+00:00)
Title: Load balancing now allowed after session discarded and session cookie deleted

A fix to allow proper request load balancing even after a session has been discarded and session cookie ('JSESSIONID') deleted.

In order to provide the session stickyness behaviour, the router considers only the vcap cookie ('__VCAP_ID__') to ensure a request is being routed to a proper backend, i.e. the backend with the right session instance. This works properly when session is valid, however when invalidated and session cookie deleted all the subsequent requests are being routed to the same backend as the vcap cookie was still present.

One solution is to somehow hook on an event when session is being invalidated and delete the vcap cookie as well, but, I have no idea how to capture such an event globally. The other solution is to consider the vcap cookie only if there is a session cookie ('JSESSIONID') present.

This fix implements the second approach has been used.

See https://groups.google.com/a/cloudfoundry.org/forum/#!topic/vcap-dev/lSLqQdPmgCk.