<p>Is there way in istio to set a custom request header (x-custom-header) with value as dynamic value (uuid) or setting value of the custom header from an already existing header?</p>
<p>I am using gateway + virtualservice + envoy(sidecar)</p>
<p>Example configuration options in nginx =
proxy_set_header x-custom-header $connection:$connection_requests;</p>
<p>I tried below snippet in my virtual service and got literal value &quot;{{ uuid }}&quot; forwarded to my application.</p>
<p>`  http:</p>
<ul>
<li><p>headers:
request:
set:
x-custom-header: '{{ uuid() }}'</p>
<p>match:</p>
<ul>
<li>uri:
prefix: /`</li>
</ul>
</li>
</ul>

aayush kumar
<p>I was able to solve this by using following snippet in virtual service</p>
<pre><code>   http:
  - headers:
      request:
        set:
          x-custom-header: '%REQ(x-request-id)%'
</code></pre>
