Browse Source

fix: only enable browser request streaming over HTTPS in Blazor WASM

SetBrowserRequestStreamingEnabled(true) requires HTTP/2, which browsers
only support over TLS (ALPN). When the target API uses plain HTTP,
the browser fails with ERR_ALPN_NEGOTIATION_FAILED on POST/PUT requests.

This change conditionally enables streaming only for HTTPS requests,
preserving the large file upload capability while fixing HTTP-only
development scenarios.
pull/25064/head
maliming 7 months ago
parent
commit
1490b32e26
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 5
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs

5
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs

@ -53,7 +53,10 @@ public class AbpBlazorClientHttpMessageHandler : DelegatingHandler, ITransientDe
options.Type = UiPageProgressType.Info;
});
request.SetBrowserRequestStreamingEnabled(true);
if (request.RequestUri?.Scheme == Uri.UriSchemeHttps)
{
request.SetBrowserRequestStreamingEnabled(true);
}
await SetLanguageAsync(request, cancellationToken);
await SetAntiForgeryTokenAsync(request);
await SetTimeZoneAsync(request);

Loading…
Cancel
Save