Require that routes have matching clusters
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 933
- Avg merge
- 12d 18h
- Merged PRs (30d)
- 2
Description
Today routes and clusters are [validated](https://github.com/microsoft/reverse-proxy/blob/d9eeb548817364c7199acadd177f699781091a48/src/ReverseProxy/Service/Management/ProxyConfigManager.cs#L208-L209) individually before officially loading the model. However, this step does not validate if every route references a real cluster. When the model is rendered later it's possible that a route will be created that has no matching cluster.
Today this is allowed and then checks are done in middleware to short circuit routes without a cluster.
https://github.com/microsoft/reverse-proxy/blob/d9eeb548817364c7199acadd177f699781091a48/src/ReverseProxy/Middleware/DestinationInitializerMiddleware.cs#L32-L37
I reviewed this with @davidni and he said the expected scenarios for this (a more dynamic pipeline) never materialized.
Proposal:
- Check that each route references a valid cluster before accepting the config as valid.
- Remove the associated checks from middleware.
Contributor guide
Assessment
This issue has not been assessed yet.