Closed georgearnall closed 4 years ago
Hi @georgearnall, does proxyUrl
contain ws
or wss
?
Yes @twitchax, although it is not above, I've just hard coded this now and it is the same issue. As mentioned, it doesn't appear to be triggering the "ui/_blazor" proxy at all. Interestingly if I add a ui/_blazor with a UseHttp proxy configuration that does trigger... See attached log, not sure if it helps point in the right direction
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();
?
Ah, I missed that! It's triggering on proxy.UseWs()
now, but it's still not going through.
app.UseWebSockets();
app.UseProxies(proxies =>
{
proxies.Map("ui/{*endpoint}", proxy => proxy.UseHttp(
(context, args) =>
{
var queryString = context.Request.QueryString;
return $"{proxyUrl}/{args["endpoint"]}{queryString}";
}, builder => builder.WithHttpClientName("proxyClient"))
.UseWs(
(context, args) => {
Console.WriteLine("WS");
var queryString = context.Request.QueryString;
return $"{proxyUrl.Replace("https://", "wss://")}/{args["endpoint"]}{queryString}";
})
);
});
Most requests will log the connection to the other server (7003), however this one just exits immediately. Could it be related to the HTTPClient? I don't seem to be able to add the same builder.WithHttpClientName("proxyClient"))
on the websocket config? I'm currently using self signed certificates.
Request starting HTTP/1.1 GET https://localhost:5003/ui/_blazor?id=TZ6JpaMsF0fDY3tgujJOQg
WS
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished in 86.0356ms 502
Interestingly, Blazor Server has now started working with long polling but this isn't really ideal.
Hi @georgearnall, I can investigate. Any way you can give me a toy app that repros this in a gist or something? :)
Or, if you want to be really nice, check this repo out and add a WS test case that fails? 😬
@georgearnall, closing this. Please let me know if you can provide a small repro. 😄
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.
I'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: