-
Notifications
You must be signed in to change notification settings - Fork 301
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
YARP service discovery broke for preview 5 & 6 ? #4137
Comments
I'm trying to spot the difference between this and what we have in our samples. Do you have the call to |
Yep program.cs of the blazor server web app...nestled in here between fluent and http... builder.Services.AddFluentUIComponents();
builder.Services.AddHttpForwarderWithServiceDiscovery();
builder.Services.AddHttpContextAccessor();
IKR - I've been scouring the lines too looking for something as I figured it had to be my fault...surely y'all would have seen such an obvious issue by now. The weird thing is that it actually does a replacement/lookup - it just gets the wrong one. |
The only diff I see between eshop and mine is that I use the Eshop app.MapForwarder("/product-images/{id}", "http://catalog-api", "/api/v1/catalog/items/{id}/pic"); Mine async ValueTask LocalAddRequestTransform(RequestTransformContext context)
{
var accessToken = await context.HttpContext.GetTokenAsync("access_token");
context.ProxyRequest.Headers.Authorization = new("Bearer", accessToken);
}
app.MapForwarder($"/api/projects/{{**catch-all}}", "https://mywebapi", transformBuilder =>
{
transformBuilder.AddRequestTransform(LocalAddRequestTransform);
}).RequireAuthorization(); That local function is for re-use because I currently have 4 different calls to
|
This may or may not still be an issue, and if it is then others will find it and perhaps report it in a better way. For now I simply changed to using the
|
This was working at preview 4. Since 5 and 6 the wrong uri is returned. It returns the one for blazor website (itself) not the webapi.
This is from program.cs in the blazor web app (server side)
program.cs from AppHost
The following are the actual URLs:
mywebapi = https://localhost:7182
websitemain = https://localhost:7237
When the YARP does it's thing, it sends the request to
https://localhost:7237/api/projects...
That is wrong.
It should be (and was)
https://localhost:7182/api/projects...
So to fix it for now I have to manually enter this and it works:
I didn't notice any new requirements to make service discovery work in the upgrade docs but maybe i missed something.
The text was updated successfully, but these errors were encountered: