<p>I am trying to work out what the most suitable way of identifying if a request came from a specific internal service, or from the outside world (or indeed a different service).</p>

<p>I can write application level code to manage this of course, but was wondering what the simplest solution using Istio would be. The goal is to avoid writing extra layers of code if they're not necessary.</p>

<p>I have JWT on the perimeter for most endpoints, but there are some open (eg. auth).</p>

<p>Thanks!</p>

<p>For this specific scenario, I assumed that you are using http, so you can use Envoy and  two http headers to determine the traffic source from internal or <a href="https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/headers#http-header-manipulation" rel="nofollow noreferrer">external</a>.</p>

<p>Option 1: With <a href="https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/headers#x-envoy-internal" rel="nofollow noreferrer">x-envoy-internal</a> you will be able to determine whether a request is internal origin or not.</p>

<p>Option 2: You can also check <a href="https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/headers#config-http-conn-man-headers-x-forwarded-for" rel="nofollow noreferrer">x-forwarded-for</a> which indicates the IP addresses that a request has generated.</p>

<p>I hope this helps.</p>
