Go to All Forums

How to validate HTTP Response Headers SET-COOKIE when multiple values are set

Hi,

I have the following challenge;
I want to check the clusters nodes separately.
I can control this by sending a COOKIE header.
Now I want to verify that the response contains a specific SET-COOKIE header containing a specific node name.
But we also set other cookies same time

< Set-Cookie: JSESSIONID=ECA9EDAA096EBCB0427E08B4913C9F6E.node-0; Path=/; Secure; HttpOnly
< Set-Cookie: COOKIE_SUPPORT=true; Max-Age=31536000; Expires=Thu, 29-Sep-2022 15:05:30 GMT; Path=/; Secure; HttpOnly
< Set-Cookie: GUEST_LANGUAGE_ID=nl_NL; Max-Age=31536000; Expires=Thu, 29-Sep-2022 15:05:30 GMT; Path=/; Secure; HttpOnly


I set Should contain HTTP Response Header(s) to "node-0"
Apparently the order of SET-COOKIES is not fixed because at times 50% it fails validating;

I also tried regular expressions;
www.site24x7.com/help/admin/adding-a-monitor/rest-api-monitor.html#http-response-header

"node-1" "COOKIE_SUPPORT" "GUEST_LANGUAGE_ID"
^.*(liferay-|COOKIE_SUPPORT|GUEST_LANGUAGE_ID).*$
${^.*(node-0).*$}

${^.*(node-0).*$}" "${^.*(COOKIE_SUPPORT).*$}" "${^.*(GUEST_LANGUAGE_ID).*$}

Unfortunately i can't see the real response headers site24x7 receives so its a bit hard to debug, just lots of trial and error.
Any suggestion how i can achieve this ?

Regards,
Corné

Like (1) Reply
Replies (3)

BTW I experienced that if we validate only "node-" without the number 0 or 1, site24x7 always validates ?!

Like (0) Reply

Actually I found out that site24x7 always connects to one specific node-1.
Site24x7 uses both Loadbalancers IP addresses, but somehow, somewhere it always gets resolved to node-1.

Like (0) Reply

Hi Corné,

 Thanks for trying out the feature before posting here. Much appreciated.

We support regex validation in Response headers where the pattern format be "${<regex>}"
For more information please visit:https://www.site24x7.com/help/admin/adding-a-monitor/website-monitoring.html#content-check

For your case "${JSESSIONID=[A-Za-z0-9]+\.node-0}" this regex will support for the above mentioned cookie. In "Should contain HTTP Response Header(s)" set the Header Name as 'Set-Cookie' and set the Header value as the mentioned regex.

Please try this and let us know if it works for you.

Regards,
Aravind R
Site24x7 Team | ZOHO Corp

Like (0) Reply

Was this post helpful?