Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cluster "Action" for given routes #1868

Closed
tswalker opened this issue Sep 21, 2022 · 2 comments
Closed

Cluster "Action" for given routes #1868

tswalker opened this issue Sep 21, 2022 · 2 comments
Labels
needs-author-action An issue or pull request that requires more info or actions from the author. Type: Idea This issue is a high-level idea for discussion.

Comments

@tswalker
Copy link

tswalker commented Sep 21, 2022

What should we add or change to make your life better?

It would be nice to leverage the HttpClient for an inbound route for generating immediate responses using the appsettings.json file with a new cluster parameter called "Action" (or similar). As "Destinations" defines how the forwarder handles the request, "Action" would permit (with appropriate properties) an immediate response without the need to handle that path within Program.cs and additional middleware.

Why is this important to you?

Currently, I need to check the path of the request for a route (say "myspecialroute") in middleware to generate a response and terminate the chain. Using something simple like:

app.Use((context, next) =>
{
	var path = context.Request.Path;
	if (path.HasValue && path.Value.Contains("myspecialroute"))
	{
		context.Response.StatusCode = StatusCodes.Status400BadRequest;
		return context.Response.WriteAsync("This integration is not supported.");
	}
	return next();
});

Having this 'actionable' configured in appsettings would be nice as if the route changed, a simple config file update would do the trick versus having to re-program the middleware.

@tswalker tswalker added the Type: Idea This issue is a high-level idea for discussion. label Sep 21, 2022
@Tratcher
Copy link
Member

You could also define these special routes in AspNet MVC/Razor/minimal. YARP shares the route table with the rest of the app.

What capabilities would you expect an 'Action' to have, and how would those be described? Can you give some example JSON definitions?

@karelz karelz added the needs-author-action An issue or pull request that requires more info or actions from the author. label Sep 27, 2022
@karelz
Copy link
Member

karelz commented Oct 11, 2022

Triage: 20 days no response, closing as not actionable. If/when there is more info, feel free to reopen. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-author-action An issue or pull request that requires more info or actions from the author. Type: Idea This issue is a high-level idea for discussion.
Projects
None yet
Development

No branches or pull requests

3 participants