jmeterhttpcookiecookiemanager

Interchanged Cookie on JMeter 5.4


I upgraded my JMeter from 3.0 to 5.4.3 due to log4j issue however I am now getting an issue on cookie handling:

JMeter 3.0 enter image description here

JMeter 5.4 enter image description here

As you can see in the result, the grid-sid-axxx was moved after JSESSIONID=z-dxxx which is causing session errors on my side. How can I interchanged these cookie value so I can avoid the session issue due to interchanged cookie value.

There were no change the HTTP Cookie Manager, HTTP Header Manager and HTTP Request samplers

Thanks,


Solution

  • As per the specification:

    Although cookies are serialized linearly in the Cookie header, servers SHOULD NOT rely upon the serialization order. In particular, if the Cookie header contains two cookies with the same name (e.g., that were set with different Path or Domain attributes), servers SHOULD NOT rely upon the order in which these cookies appear in the header.

    so my expectation is that the order of cookies which are being sent in Cookie header is not important and the request should be successful given both cookies are present.

    So it may worth contacting your application developers in order to get the issue fixed on their end.

    Also it's always possible to extract cookies from the response using Regular Expression Extractor and add the HTTP Header Manager configured to send the Cookie header with the values in the order your want.