Idea: Customize the Host header for active health checks
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 933
- Avg merge
- 12d 18h
- Merged PRs (30d)
- 2
Description
We look into YARP, because our current setup consist of the following flow for incomming traffic:
Internet -> LoadBalancer (L4) -> Proxy-Farm -> LoadBalancer (L4) -> Application Farm.
Both proxy farm and application farm use name based hosting.
So the idea I want to discuss is enable **application based proxying**
Let's assume IIS-N (with n > 1) are N machines hosting multiple applications: a.contoso.com and b.contoso.com.
Both applications can exist, fail and run idependently from each other.
A YARP config might look like this:
```json
"ProxyConfigration": {
"Clusters": {
"a.constoso.de": {
"Destinations": {
"a.contoso.de/IIS-1": {
"Address": "https://...IPV6-Address.../"
},
"a.contoso.de/IIS-2": {
"Address": "https://...IPV6-Address.../"
},
"a.contoso.de/IIS-3": {
"Address": "https://...IPV6-Address.../"
},
"a.contoso.de/IIS-4": {
"Address": "https://...IPV6-Address.../"
}
},
"b.constoso.de": {
"Destinations": {
"b.contoso.de/IIS-1": {
"Address": "https://...IPV6-Address.../"
},
"b.contoso.de/IIS-2": {
"Address": "https://...IPV6-Address.../"
},
"b.contoso.de/IIS-3": {
"Address": "https://...IPV6-Address.../"
},
"b.contoso.de/IIS-4": {
"Address": "https://...IPV6-Address.../"
}
},
}
},
"Routes": [
{
"RouteId": "a.contoso.de",
"ClusterId": "a.contoso.de",
"Match": {
"Hosts": [ "a.contoso.de" ]
},
"Transforms": [
{ "RequestHeaderOriginalHost": "true" }
]
},
{
"RouteId": "b.contoso.de",
"ClusterId": "b.contoso.de",
"Match": {
"Hosts": [ "b.contoso.de" ]
},
"Transforms": [
{ "RequestHeaderOriginalHost": "true" }
]
}
]
}
```
Now defining health-checks foreach application will be difficult to not possible, since the host-header is needed for an active health check. Or alternatively I'd need to bind new Addressees on the destination servers.
If we make YARP application aware this could be circumvented. Consider the following:
```json
"ProxyConfigration": {
"Clusters": {
"IIS-Farm": {
"Destinations": {
"IIS-Farm/IIS-1": {
"IPAddress": "...IPV6-Address..."
},
"IIS-Farm/IIS-2": {
"IPAddress": "...IPV6-Address..."
},
"IIS-Farm/IIS-3": {
"IPAddress": "...IPV6-Address..."
},
"IIS-Farm/IIS-4": {
"IPAddress": "...IPV6-Address..."
}
},
"Applications": {
"a.contoso.de": {
"ClusterId": "IIS-Farm",
"Address": "https://a.contoso.de",
"Health": "https://a.contoso.de/health"
},
"b.contoso.de": {
"ClusterId": "IIS-Farm",
"Address": "https://b.contoso.de",
"Health": "https://b.contoso.de/health"
}
},
"Routes": [
{
"RouteId": "a.contoso.de",
"ApplicationId": "a.contoso.de",
"Match": {
"Hosts": [ "a.contoso.de" ]
}
},
{
"RouteId": "b.contoso.de",
"ApplicationId": "b.contoso.de",
"Match": {
"Hosts": [ "b.contoso.de" ]
}
}
]
}
```
This would allow for a very consice definition of routes and health checks in a name-based hosting environment, where mutliple applications share the same application server.
Contributor guide
Assessment
This issue has not been assessed yet.