Support `IDistributedCache` (or similar mechanism) for proxy config invalidation instead of relying only on `IChangeToken`
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 933
- Avg merge
- 12d 18h
- Merged PRs (30d)
- 2
Description
Currently, YARP relies on `IChangeToken` to detect and propagate configuration changes for proxy routes and clusters. This works fine in a single-node setup, but in a distributed architecture it becomes a limitation.
For example:
* I have a WebAPI where I update proxy configuration dynamically.
* My MVC application (which uses YARP) runs in a separate process, or can be in another server
* Since YARP only listens for `IChangeToken` changes, the MVC app never learns about the configuration updates that happened in the WebAPI process.
This makes it impossible to reflect configuration changes across distributed apps without reloading or manually syncing configurations.
**Proposal:**
Add support for `IDistributedCache` (or a pluggable distributed store abstraction) as a configuration source for YARP. That way:
* Updating configuration in one app (e.g., via WebAPI) would write to the distributed cache.
* Other apps using YARP would read from the same distributed source and automatically reflect the configuration changes.
This would enable YARP to be used seamlessly in distributed architectures without needing custom synchronization layers.
**Example Scenario:**
* WebAPI updates the proxy routes in Redis (via `IDistributedCache`).
* MVC app using YARP picks up the new routes automatically without restart.
.NET 9 `HybridCache` is also a good alternative.
Contributor guide
Assessment
This issue has not been assessed yet.