Current state
In order to use the service mesh, teams generally need to implement some form of the following for their desired HTTP client:
- Rewrite the target URL to replace the hostname portion with the host:port of the local envoy listener for that service.
- Set the Host header to the previously rewritten hostname portion in #1.
- Deal with redirects (e.g., an absolute redirect that again needs rewriting as in #1 and #2).
This is further complicated by the fact that not all HTTP clients will allow #2 - e.g., Node's native fetch (i.e., not node-fetch) now exhibits similar behavior to that dictated by the Fetch API, namely that the Host header cannot be overridden in code (note: opinions vary on why Node behaves this way, in terms of whether it's an intentional effort to comply with the API specification or not).
Definition of done (DRAFT)
An experimental service-utils feature that provides a batteries-included implementation of the high-level rewriting logic described above, built on an actively maintained (i.e., not preq) HTTP client in common use among Node.js services at WMF (e.g., Axios).
As part of this, a new template helper should be introduced in the mesh.configuration helm chart module, so that service owners can easily inject a manifest of enabled mesh listeners into their application's configuration.