Hi Atul,
From my understanding, the Header control → Allowlist field in the Invoke policy may not support runtime substitution using context variables like $(allowedheaderlist). The values in this section are typically treated as static configuration and may not resolve variables set through GatewayScript.
If dynamic control of headers is required, one possible approach could be to handle the header filtering in a GatewayScript policy before the Invoke policy by modifying context.message.headers programmatically.
However, I have not tested this scenario yet, so it would be good to confirm if others in the community have implemented a similar solution.
Thanks.
------------------------------
Amutha Karuvelamuthu
Adaptive Development Private Limited
------------------------------