What is the Cookie Content field used for?
Short answer
Cookie Content is the value that identifies this Backend Service when cookie-based persistence (New Cookie, Current Cookie or the Cookie Based Connection Persistency action) is used on an HTTP vService. TR7 writes this value to the persistence cookie; when the client sends the cookie back in subsequent requests, the request goes to the same server. It has no default value: while it is empty, New Cookie and Current Cookie generate the value automatically from the address of the server. Giving a readable name (e.g. web01) makes it easier to understand which server the request goes to by looking at the cookie.
How Does It Work?
The value is used only while cookie-based persistence is on:
| Persistence method | Role of Cookie Content |
|---|---|
| New Cookie | TR7 adds its own cookie (default name TR-C); the value of the cookie is the Cookie Content of the server |
| Current Cookie | Cookie Content is added in front of the value of the application's own cookie |
| Cookie Based Connection Persistency action | The same value is used; while the field is empty, the value is generated automatically only if the Cookie Is Dynamic option is on in the action |
| Hash, SAM or no persistence | Not used |
Format Rules
- Characters other than letters, digits and the hyphen (
-) (dots, spaces, Turkish characters) are converted to an underscore (_):web.01→web_01. - Upper/lower case is preserved.
- Since the value identifies the server, a different value is given to each Backend Service.
When the Field Is Empty
In the New Cookie and Current Cookie methods, TR7 generates the value automatically from the address of the server and a key specific to the vService. Persistence still works; however, the value is not readable, and if the IP or port of the server changes, the value also changes, in which case the existing pinning of the clients is lost.
In TR7
- Single Backend Service: Load Balancer → Backend Services → Add or Edit → Details switch → Cookie Content; it is saved with the button at the bottom of the form.
- Backend Group: It is per server; it is entered separately for each row in the Cookie Content column of the Backends table. To see the values per server in the list, the Show Backend Services switch is turned on.
- The persistence method is selected in the Persistence setting of the vService.
- Change: When Cookie Content is changed, the pinning of the clients that carry the old value becomes invalid and these clients are redistributed.
- Cluster: While Clustering is on and Manual Sync Mode is off (default), the value is transferred to the peer device automatically; since both devices use the same value, the cookie is valid on both devices.
Common Misconceptions
- "Cookie Content turns on persistence." The field only determines the value; persistence is selected on the vService.
- "I write the name of the cookie in Cookie Content." The value of the cookie is written here; the name is in the persistence setting of the vService.
- "If I leave it empty, persistence does not work." In New Cookie and Current Cookie, the value is generated automatically and persistence works.
- "It appears as
web.01." The dot is converted to an underscore;web_01appears in the cookie.
How it is done in the documentation
