Skip to content

Kestrel reloadable config #19376

Closed
Closed
@Tratcher

Description

@Tratcher

Is your feature request related to a problem? Please describe.

It's common for an application to add, remove, or reconfigure endpoints via config. That works today for Kestrel but it requires restarting the application to pick up the changes.

For reference, HttpSys supports live adding or removing endpoints in code, but not in config.

public HttpSysOptions ServerOptions { get; set; }
public void Configure(IApplicationBuilder app)
{
var addresses = ServerOptions.UrlPrefixes;
addresses.Add("http://localhost:12346/pathBase/");
app.Use(async (context, next) =>
{
// Note: To add any prefix other than localhost you must run this sample as an administrator.
var toAdd = context.Request.Query["add"];
if (!string.IsNullOrEmpty(toAdd))
{
context.Response.ContentType = "text/html";
await context.Response.WriteAsync("<html><body>");
try
{
addresses.Add(toAdd);

Describe the solution you'd like

Have Kestrel's custom configuration binder register for config reload notifications. On config change it would need to diff the changes and update its endpoints. Removing an endpoint should also cause existing connections for that endpoint to gracefully drain and close.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-kestrel

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions