8000 GitHub - MK-NEUKO/article: Sample projects for my technical articles · GitHub
[go: up one dir, main page]

Skip to content
MK-NEUKOPublic

About

Sample projects for my technical articles

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

article

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

YARP: change the destination at runtime

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.

Run

dotnet run --project YARP-change-destination-at-runtime/ReverseProxy.Api

In development the API reference (Scalar) is available at /scalar. Example:

curl -X POST http://localhost:5227/change-address/example.com

License

MIT


Made by Michael Koch · NeuKo know-how

About

Sample projects for my technical articles

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0