Skip to content

Commit 2a37a31

Browse files
committed
docs: Add FAQ entry for __Host- prefixed session cookie behavior
1 parent 026444d commit 2a37a31

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/03-how-to-use-session-affinity.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,22 @@ sticky backend).
121121
No additional configuration is required; the `__Host-` prefix is handled automatically for every
122122
name listed in `router.sticky_session_cookie_names`.
123123

124+
### What happens when both `JSESSIONID` and `__Host-JSESSIONID` are in the same response?
125+
Gorouter creates a `__VCAP_ID__` + `__VCAP_ID_META__` pair for each session cookie — the same
126+
behaviour as [CHIPS migration](#how-does-gorouter-support-chips-cookie-migration). Since both
127+
`__VCAP_ID__` cookies share the same name and (unless one is `Partitioned`) the same browser
128+
cookie jar slot, the browser will only retain the last one.
129+
130+
In practice this is not a concern: unlike CHIPS migration, there is no need to set both cookies in
131+
the same response. Because `JSESSIONID` and `__Host-JSESSIONID` are distinct cookie names in the
132+
browser's jar, the expected migration path is for the application to simply stop setting
133+
`JSESSIONID` and start setting `__Host-JSESSIONID` — the old cookie expires naturally.
134+
135+
Note: if an application were to set a new `__Host-JSESSIONID` alongside a delete (`Max-Age=0`) for
136+
the old `JSESSIONID` in the same response, both would produce a `__VCAP_ID__` in the same cookie
137+
jar partition. Depending on processing order, the browser could apply the delete `__VCAP_ID__`
138+
after the new one, effectively removing it.
139+
124140
### What happens if only one of `JSESSIONID` or `__VCAP_ID__` cookies is set on a request?
125141
Gorouter requires both `JSESSIONID` and `__VCAP_ID__` to be present for sticky session routing.
126142
If only one of them is present, Gorouter will route the request to a random available application

0 commit comments

Comments
 (0)