Sample projects that go with my technical articles. Each folder is a self-contained example.
| Folder | Topic |
|---|---|
YARP-change-destination-at-runtime |
Change the destination of a YARP reverse proxy while it is running – no restart, no config file edit |
A minimal ASP.NET Core API (.NET 9) with a YARP reverse proxy
whose configuration lives in memory instead of appsettings.json
(LoadFromMemory). That makes it possible to swap the destination through an endpoint:
| Endpoint | What it does |
|---|---|
GET /get-configuration |
returns the current routes and clusters |
POST /change-address/{address} |
points every destination to https://{address} |
How it works: Configurator reads the current configuration, builds new clusters with the new address
(keeping health checks, session affinity and the other settings) and hands them to YARP's
InMemoryConfigProvider.Update(...). YARP picks up the change for the next request.
dotnet run --project YARP-change-destination-at-runtime/ReverseProxy.ApiIn development the API reference (Scalar) is available at /scalar. Example:
curl -X POST http://localhost:5227/change-address/example.comMade by Michael Koch · NeuKo know-how