The above link uses JSON extractor to correlate the value. As you rightly noticed, the JSON extractor can be used only on the body of the response and not on the headers (cookies mostly appear in the response headers). For this purpose, we will have to revert to our traditional Regular expression extractor.

Select "Field to check" as "Response Headers" and we are good to go. In this case, Regular Expression needs to be utilized for extracting the value and the approach used in the OPs link cannot be leveraged.
For example, if my response headers are as below,

and if I want to capture the NID token which is in line 11 as part of the Set-Cookie parameter, I would use the below Regex.

The cookie value is captured and available for utilization. This is visible in the Debug Sampler.

For additional information on how to do correlation using regular expression extractor, use this link How to do Correlation
Hope this helps!