Replies: 4 comments
-
Alternatively, is there a way I could retry to a different cluster I attempted public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
if(context.Response.HasStarted) return;
var error = await _httpForwarder.SendAsync(context, "https://localhost:7114", _httpClient, _requestOptions);
if (error == ForwarderError.None && context.Response.StatusCode != StatusCodes.Status404NotFound)
{
return;
}
error = await _httpForwarder.SendAsync(context, "https://localhost:9114", _httpClient, _requestOptions);
if (error != ForwarderError.None || context.Response.StatusCode == StatusCodes.Status404NotFound)
{
context.Response.StatusCode = StatusCodes.Status404NotFound;
}
} But it isn't possible because the request has already started and such throws an error. |
Beta Was this translation helpful? Give feedback.
-
What does your route configuration look like? "Match": {
"Path": "{**catch-all}"
},
"Order": 1000000 // Higher = lower priority You should also try enabling debug ASP.NET logs to observe when and why a given routing decision was made. If that doesn't solve it, it would be useful if you're able to narrow down the problem to a minimal, runnable, example that reproduces the issue. Regarding retries, you can read through the discussion in #56. It's not built-in, but possible with some restrictions. |
Beta Was this translation helpful? Give feedback.
-
My config is in the collapse in the first comment, that's all that is setup and seems to work the best. I had tried setting Order higher and lower, since it is one endpoint, But I've been trying a lot of things today, but it seems like it is a controller issue out of all things //Controller
[ApiController]
[Route("api/[controller]")]
public class TestController(IService service) : ControllerBase
{
[HttpPost("HelloWorld2")] // This works
[AllowAnonymous]
public ActionResult<string> PostHelloWorldTest(HelloWorldRequest? request)
{
return service.HelloWorldTest(request?.Key);
}
[HttpGet("HelloWorld2")] // Trying to reach this one will not resolve and fall back to the cluster1
[AllowAnonymous]
public ActionResult<string> GetHelloWorldTest()
{
if (HttpContext?.User?.Identity?.IsAuthenticated == true)
{
return $"¡Hola {HttpContext.User.Identity.Name}!";
}
return service.HelloWorldTest();
}
}
// Program.cs
app.MapGet("/api/test/helloworld", () => "Hello World!"); // this works without problems |
Beta Was this translation helpful? Give feedback.
-
Well, it seems i have found my issue after half a day, the culprit in question was [Consumes("application/json")]
[Produces("application/json")] I might need some coffee☕... |
Beta Was this translation helpful? Give feedback.
-
I've been stuck on a problem, I currently host YARP inside the new Application that is going to constrict the old application, I want everything that isn't found inside the new implementation to fallback to the old app, and incrementally move the code, but I've been running into some issues where GET's won't work in the new application and will always be send to the fallback, even if the GET is in the same controller as one with a POST, the POST works and routes fine, the GET will end up getting send to the OLD one.
I've tried a couple configuration, but I can't seem to get a working correctly with any
Configuration that works most of the time
Program.cs
Beta Was this translation helpful? Give feedback.
All reactions