<p><strong>Dynamic request routing based on header-values</strong></p>
<p>For our QA environment we need to configure a special kind of routing for the incoming (Ingress), but also for the outgoing (Egress) requests. So for outgoing requests the rule should evaluate a header value with a regex and capture a value from the header and build with that value the URL where the request should be redirected. The value in the header is dynamically changed, so the redirect URL can not be hardcoded.</p>
<p>For example if the outgoing requests goes to <strong>services-master.anydomain.com</strong>, but there's a header value <strong>forwarded-for-feature</strong> with the value <strong>verbu-1234</strong> the request should be redirected <strong>services-verbu-1234.anydomain.com</strong>.</p>
<p>For incoming requests it's a similar condition. If the <strong>origin</strong> points to <strong>webapp-verbu-1234.anydomain.com</strong>, but the request goes to <strong>services-master.anydomain.com</strong> the regex should extract <strong>verbu-1234</strong> from the origin domain and replace <strong>master</strong> in the URL with the extracted value.</p>
<p>I know, that it's possible to use a regex to match header values, but I'm not sure, if it's possible to use captured values from a match to influence the target URL, at least I couldn't find that in the documentation.</p>

<p>I don't think this is possible</p>
<p>But if your QA system knows the features available, and you need to do that in Istio, you might try creating a VirtualService for each feature. And multiple VirtualServices would be merged by Istio...</p>
