BLOCKER ISSUE: After reopening browser the registered HttpClient refers to wrong base address #57739
Unanswered
ManrajPatel
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am developing Blazor Web App with Duende Identity Server. In my Blazor (server) app I am registering
HttpClient
for myCustomerService
using following statement:services.AddHttpClient<CustomerService>("customer", o => o.BaseAddress = new("https://apiservice"));
In my Blazor.Client app I have implemented custom authentication state provider
BffAuthenticationStateProvider
(implementesAuthenticationStateProvider
) that uses Duende.Bff to fetch user claims. Following is the code to registerHttpClient
for this custom Authentication state provider:builder.Services.AddHttpClient<BffAuthenticationStateProvider>("backend", client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress));
Now ideally when I call any
CustomerService
method, the injectedHttpClient
should refer https://apiservice/ as base address and it does work when I run the app for the first time.ISSUE: But if I close and reopen my browser and try to call the same CustomerService method, the injected HttpClient considers builder.HostEnvironment.BaseAddress as base address and that results in an error because the URL is having a wrong base address.
Can someone please explain what is causing above behavior and how this can be resolved?
Beta Was this translation helpful? Give feedback.
All reactions