Proxy Blazor Server Application Websocket
See original GitHub issueI’m trying to proxy a Blazor Server Application. I have managed to proxy the initial page load and retrieve all static files. I cannot get the SignalR websocket connection to establish. Is this supported? The Websocket proxy definition is never triggered and I get 502 error codes on the _blazor?id=XXX websocket request
I have the following config:
app.UseProxies(proxies =>
{
// SignalR Connection
proxies.Map("ui/_blazor", proxy => proxy.UseWs((context, args) =>
{
var queryString = context.Request.QueryString;
return $"{proxyUrl}/{args["endpoint"]}{queryString}";
}));
// Fallback
proxies.Map("ui/{*endpoint}", proxy => proxy.UseHttp(
(context, args) =>
{
var queryString = context.Request.QueryString;
return $"{proxyUrl}/{args["endpoint"]}{queryString}";
}, builder => builder.WithHttpClientName("proxyClient")));
});
/// services
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
// Disable Certificate Validation
ServerCertificateCustomValidationCallback = (_, __, ___, ____) => true,
UseDefaultCredentials = true
});
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
.NET 6 | C# | Blazor Server websocket connection failed ...
I have Blazor Server app, which is hosted on our VPS in docker, behind nginx reverse proxy. If I go to the web,...
Read more >Blazor server-side behind a proxy issue : r/dotnet
The whole idea with Blazor Server is using websockets to transfer data. With the Blazor Server hosting model, the app is executed on...
Read more >Host and deploy Blazor Server - ASP.NET Core
To host a Blazor app behind Apache on Linux, configure ProxyPass for HTTP and WebSockets traffic. In the following example: Kestrel server is ......
Read more >Blazor Server side app Failed to connect via WebSockets
I have a Blazor web app that used to run fine in Azure. The latest deployment does not work. It works fine locally...
Read more >Why does this MS Blazor App Websocket connection fail?
By default when you proxy through Cloudflare it minifies the HTML, as well as CSS / JS, and in doing so it strips...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It looks like, in the log, that the web server is interpreting this request as an http request.
Request starting HTTP/1.1 GET https://localhost:5003/ui/_blazor?id=KfqJrgcpG8oS2kD2e7uMoA
Did you “turn on” websocket support by using
app.UseWebSockets();
?Apologies for not getting back to you, I’ve been pretty busy. This might be something I will come back to in the future. For now I have switch to WebAssembly and no longer require the proxy. Thanks for your help nonetheless.