Middleware by tenants


I'm working with micro-services and using a custom path to redirect to each micro-service.
Currently, I need to pass a custom header that changes for each domain (tenant) calling the micro-services

for example:
https://foo.example.com/* must pass a header with "X-Tenant: foo"
https://bar.example.com/* must pass a header with "X-Tenant: bar"
and so on

I find the HTTP middleware and chain middleware but cannot find a way to apply this for all of my micro-services. There is a way to make a chain middleware by route?