<p>I have a kubernetes cluster and i have more than 15 microservices running in it, Each REST API send me a custom header lets say &quot;version&quot;:&quot;1.2.0&quot;, i need to check this version from each REST api and throw a custom error if it doesn't match with the value i have.</p>
<p>Suppose i have a mobile app and i have released a new version of the app and redeployed the microservices to match the new app, i want to throw a custom error to users using the old application to download the new app to continue using the application.</p>
<p>Is there a way to achieve this using ingress-nginx or in the kubernetes level instead of repeating logic in each microservice.</p>

<p>With <code>Nginx ingress</code>, you will be able to inject the secret into the request if it's coming outside and forward request to service</p>
<pre><code>nginx.ingress.kubernetes.io/configuration-snippet: |
  proxy_set_header My-Custom-Header $http_my_custom_header;
</code></pre>
<p>since as your all microservices talking internally and routing based on custom header you can use the service mesh <code>istio</code></p>
<p>for example : <a href="https://istio.io/latest/docs/tasks/traffic-management/request-routing/#route-based-on-user-identity" rel="nofollow noreferrer">https://istio.io/latest/docs/tasks/traffic-management/request-routing/#route-based-on-user-identity</a></p>
<p><a href="https://dwdraju.medium.com/simplified-header-based-routing-with-istio-for-http-grpc-traffic-ff9be55f83ca" rel="nofollow noreferrer">https://dwdraju.medium.com/simplified-header-based-routing-with-istio-for-http-grpc-traffic-ff9be55f83ca</a></p>
