-
-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
The plain HTTP requests work, however websockets fail to connect.
This is the error that I see in the browser console that attempts to establish the connection:
[vite] connecting... client.ts:19:8
GETwss://localhost:7186/vite-ws
[HTTP/1.1 502 Bad Gateway 51ms]
GET
wss://localhost:7186/vite-ws
Status
502
Bad Gateway
VersionHTTP/1.1
Transferred309 B (0 B size)
Firefox can’t establish a connection to the server at wss://localhost:7186/vite-ws. client.ts:78:17
The relevant code:
if (isDevelopment)
{
const string vitePort = "5173";
app.UseProxies(proxies =>
{
proxies.Map("/vite-ws", proxy => proxy
.UseWs($"wss://localhost:{vitePort}/vite-ws"));
proxies.Map("/{**all}", proxy => proxy
.UseHttp((_, args) => $"https://localhost:{vitePort}/{args["all"]}"));
});
}I'm not seeing a websocket request being sent to the endpoint in the server console, but I do see a multiple of these quite suspicious logs:
info: System.Net.Http.HttpClient.AspNetCore.Proxy.HttpProxyClient.ClientHandler[101]
Received HTTP response headers after 4.6509ms - 304
info: System.Net.Http.HttpClient.AspNetCore.Proxy.HttpProxyClient.LogicalHandler[101]
End processing HTTP request after 4.715ms - 304
warn: Microsoft.AspNetCore.Server.Kestrel[41]
One or more of the following response headers have been removed because they are invalid for HTTP/2 and HTTP/3 responses: 'Connection', 'Transfer-Encoding', 'Keep-Alive', 'Upgrade' and 'Proxy-Connection'.
I don't know much about HTTP headers, but they might be related to this. Maybe I just need to enable some of these https://content-security-policy.com/
Also, the request used HTTP/1.1, but ASP.NET Core seems to be expecting HTTP/2 or /3, which may or may not matter.
I'm on .NET 6.
Metadata
Metadata
Assignees
Labels
No labels