When you configure a cookie persistence profile to use the HTTP Cookie Insert or HTTP Cookie Rewrite method, the BIG-IP system inserts a cookie into the HTTP response, which well-behaved clients include in subsequent HTTP requests for the host name until the cookie expires. The cookie, by default, is named BIGipServer<pool_name>. The cookie is set to expire based on the time-out configured in the persistence profile. The cookie value contains the encoded IP address and port of the destination server.

Convert the resulting 2-byte hexadecimal value to its decimal equivalent.

For example, if the port of the destination server is 8080, the BIG-IP LTM system encodes the port as follows:

8080 = 0x1F90

Reverse byte order = 0x901F

0x901F = 36895

Note: If the port value is less than 256, the first byte in step 1 is 0x00. For example, if the port value is 80, the BIG-IP LTM system encodes the port as follows: 80 = 0x0050Reverse byte order = 0x50000x5000 = 20480

Persistence cookie value

The BIG-IP system combines the two encoded values and inserts them into the persistence cookie. For example, using the IP address and port 10.1.1.100:8080 as encoded above, the persistence value that the BIG-IP LTM system encodes in the cookie is as follows:

1677787402.36895.0000

Note: The field following the port encoding is reserved for future use and always contains four zeros as placeholders.

Decoding persistence cookie values

You can decode the cookie value by reversing the encoding algorithms previously detailed.

For example, using the IP address and port 10.1.1.100:8080 as previously encoded, the persistence value that the BIG-IP LTM system encodes in the cookie is as follows:

1677787402.36895.0000

The first field in the cookie references the IP address of the destination server.

Convert the decimal value 1677787402 to its 4-byte hexadecimal equivalent:

0x6401010A

Split into four hexadecimal bytes and reverse the byte order:

0x0A 0x01 0x01 0x64

Convert each 1-byte hexadecimal value to its equivalent decimal value, one per octet:

10.1.1.100

The second field in the cookie references the port of the destination server.

Convert the resulting 2-byte hexadecimal value to its decimal equivalent:

8080

Note: You can use an iRule to intercept and decode persistence cookies using the algorithms above. One example is the Persistence Cookie Logger in the DevCentral codeshare. A DevCentral login is required to access this content.