Allow __VCAP_ID__ session cookie to have Max-Age>0#530
Allow __VCAP_ID__ session cookie to have Max-Age>0#530b1tamara merged 1 commit intocloudfoundry:developfrom
Conversation
src/code.cloudfoundry.org/gorouter/proxy/round_tripper/proxy_round_tripper_test.go
Outdated
Show resolved
Hide resolved
a805d2f to
85d600c
Compare
|
To give some context I dug through all the code refactoring and subtree merges and found the commit which originally introduced this: 87a7eee. It used to be that none of the attributes of the sticky session cookie would be copied but this change introduced the copying of a negative MaxAge property that indicates that the app wants to invalidate a previous session cookie. This seems to be the main target of that commit: allow changing the sticky session by invalidating an old cookie. What this missed (and what is still in there) is that an app might invalidate the old and issue a new cookie in one go which gorouter does not support due to the break in the loop and only ever issuing one VCAP_ID cookie. @hoffmaen and I already discussed this behavior and it's also described in #529. Edit: should've read the issue which already contains the reference 🥲 |
src/code.cloudfoundry.org/gorouter/proxy/round_tripper/proxy_round_tripper_test.go
Outdated
Show resolved
Hide resolved
85d600c to
3aa9fda
Compare
3aa9fda to
9d90ac0
Compare
Summary
This Pull-Request fixes #429
With this change, we unconditionally copy the
Max-Ageattribute from theJSESSIONIDcookie to the__VCAP_ID__cookie, regardless of whether its value is positive or negative. Previously, theMax-Ageattribute was only copied when its value was negative.Backward Compatibility
Breaking Change? No
This Pull-Request impacts the lifecycle of the
__VCAP_ID__cookie. Previously, when a CF application set a positiveMax-Agevalue for theJSESSIONIDcookie, which defines when the cookie becomes invalid, Gorouter ignored this attribute. This caused theJSESSIONIDand__VCAP_ID__cookies to be invalidated at different times, leading to inconsistency. This Pull-Request fixes this behavior.