The kernel-mode output cache supports the varyByHeaders attribute, but not varyByQuerystring.
varyByHeaders specifies a semicolon-separated list of HTTP headers used to vary the output cache. When this attribute is set to multiple headers, the output cache contains a different version of the requested document for each combination of specified headers. you can try to set it in the profiles property.
More information you can refer to this link: Configuration Sample.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.