cloudfoundry / gorouter

CF Router
Apache License 2.0
441 stars 226 forks source link

feat: hack: support the "Partitioned" flag on VCAP_ID cookies #396

Closed peanball closed 8 months ago

peanball commented 8 months ago

The Partitioned flag is used for cookies that are set on web sites embedded via iframes. The cookie is then available only in combination of the host site and the embedded site.

Golang's http.Cookie type does not yet support the Partitioned flag, but Google Chrome is already testing mandatory support and rejecting/omitting cookies without it for 1% of users via A/B roll-out.

The implementation wraps the http.Cookie and extends it with the Partitioned field. This field is then used to forward the raw cookie string when creating the derived VCAP_ID cookies for sticky sessions.

Once the Golang standard library supports the Partitioned flag, this wrapper can just be removed.

A test that checks the Unparsed section of the http.Cookie will ensure that the tests will fail once the Partitioned flag is supported by the Golang standard library.

Users of Safari and Google Chrome (currently 1% via A/B test, soon 100% of users) and websites that use iframes.