I am building a Blazor Web Assembly app that uses SignalR that reaches out to a hub that lives in a docker container. When I run Blazor locally everything works fine, even when the hub is in the container. However, when I containerize the Blazor app with docker and run with nginx it doesn't work. I've tried having blazor reach out to the dub container directly and through a reverse proxy using nginx.conf to no avail. Here's what I know:
- The containerized Blazor app is successfully linking up to the hub and communication is flowing back and forth between the two. I know this be I can see the traffic on the websocket in the network tab of the dev tools in the browser. The traffic is the same traffic that I see when I run Blazor locally. The subscription just isn't getting hit. It's like I have no subscription at all.
Here's my code in the hub and the Blazor app along with my nginx.conf
Hub
await foreach (var stream in _accessor.ChatAsync(messages, model)) { responseStreams.Add(stream); await Clients.Caller.SendAsync("ReceiveMessage", "test usernam", stream); }Blazor
hubConnection = hubAccessor.GetHubConnection(); hubConnection.On<string, ChatResponseStream>("ReceiveMessage", (user, chunk) => { ProcessChunk(chunk); InvokeAsync(StateHasChanged); }); await hubConnection.StartAsync();nginx.conf
events {} http { include /etc/nginx/mime.types; server { listen 7070; server_name localhost; root /usr/share/nginx/html; index index.html; location / { try_files $uri $uri/ /index.html; } location /chathub { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass "http://chathub:8080/chathub"; } } }Any help would be greatly appreciated as I have been dealing with this for several days now.