First, this post will not cover the basics of recoding macros or use of the session handling rules in BurpSuite. There are a lot of basic stuff to be found in the internet . However, by default, Burp is unable to update or modify an http request HTTP header by using session handling rules and macros. This can cause in problems if you investigate REST APIs or applications which protects requests with one-time CSRF tokens. Further, the Portswigger community blog is not very useful to address this problem .
However, the portswigger github repo provides an easy solution. The Readme.md describes the steps to configure the session handling rule to update an http header using a crafted burp plugin. All information about the implementation of the plugin is provided in the repo as well. Summarizing, everything that needs to be done is to clone the custom session token repository , update the global variable SESSION_ID_KEY in the BurpExtender class, build and load the Burp plugin. Quite easy.