Repository navigation
Fix Blazor WASM Standalone HTTPS failure with Gateway - #67547
Conversation
The Blazor Gateway replaced the DevServer in #66729, switching from Host.CreateDefaultBuilder (which auto-configures Kestrel HTTPS) to WebApplication.CreateSlimBuilder (which does not). This caused 'blazorwasm' template projects to throw InvalidOperationException when using an https:// launch profile URL. Add UseKestrelHttpsConfiguration() to BlazorGateway.BuildWebHost so Kestrel can bind HTTPS endpoints. Fixes #67484 Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression in the Blazor WebAssembly standalone template’s Gateway host where launching with an https:// URL fails because WebApplication.CreateSlimBuilder doesn’t automatically opt into Kestrel HTTPS configuration (unlike Host.CreateDefaultBuilder + ConfigureWebHostDefaults).
Changes:
- Opt into Kestrel HTTPS configuration for the Blazor Gateway host by calling
builder.WebHost.UseKestrelHttpsConfiguration().
|
|
||
| builder.Services.AddServiceDiscovery(); | ||
|
|
||
| builder.WebHost.UseKestrelHttpsConfiguration(); |
There was a problem hiding this comment.
Addressed in 66f5f4c with a regression test that starts the gateway on https://127.0.0.1:0 using a shared test certificate and verifies it binds an HTTPS address.
8887674 to
cb9e29c
Compare
Co-authored-by: lewing <[email protected]>
Co-authored-by: lewing <[email protected]>
| /// Reads ClientApps config section for endpoint manifests and YARP reverse proxy configuration. | ||
| /// </summary> | ||
| public static WebApplication BuildWebHost(string[] args) => | ||
| BuildWebHost(WebApplication.CreateSlimBuilder(args)); |
|
/backport to release/11.0-preview6 |
|
Started backporting to |
Summary
The Blazor Gateway (introduced in #66729) replaced the DevServer for standalone WASM templates, switching from
Host.CreateDefaultBuilder+ConfigureWebHostDefaults(which auto-configures Kestrel HTTPS) toWebApplication.CreateSlimBuilder(which does not).This caused
blazorwasmtemplate projects to throwInvalidOperationException: Call UseKestrelHttpsConfiguration() on IWebHostBuilderwhen using anhttps://launch profile URL.Fix
Add
builder.WebHost.UseKestrelHttpsConfiguration()toBlazorGateway.BuildWebHost()so Kestrel can bind HTTPS endpoints, matching the behavior of the old DevServer.Fixes #67484