Cookie handling: -I ensures unique Set-Cookie name attribute

A junction configured with a -j option causes Set-Cookie headers in responses from back-end servers to have their path attribute value converted to "/", and their name attribute modified by including the junction point. Sometimes the modification of the name attribute with the junction point does not result in mutually exclusive cookies.

Standard -j option operation:

If the following header:

is received from a backend server for the -j junction /sales, then the modified header sent to the browser would be:

However, if another Set-Cookie header with the same name attribute, but a different path value, is received over the same junction, the modified header would result in the exactly same name and path information.

For example:

is modified to:

Because the second modified Set-Cookie header has the same cookie name and path as the first header, it overwrites the first. The junction point is not enough to uniquely identify the Set-Cookie header.

Solution:

We can configure a -j junction with the additional -I option to add the original path attribute value (for example, /orders) to the modified name of the cookie. Now the cookie names are unique. The following rules apply when using the -I option:

For example, if the following header:

is received from a backend server for the -j -I junction /sales, then the modified header sent to the browser would be:

Parent topic: Handling cookies from servers across multiple -j junctions