Skip to content

Support IDistributedCache (or similar mechanism) for proxy config invalidation instead of relying only on IChangeToken #2960

@gumbarros

Description

@gumbarros

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: FeedbackThis issue is general feedback and doesn't represent actionable work.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions