Blazor Server Hosting

Job ID: 33077677

Budget: $30 – $250 CAD

I need someone with experience deploying Blazor Server applications to Ubuntu servers using Nginx.

The issue I'm experiencing is when I run the application I can immediately connect to the web page and navigate without any issue. When I navigate away to a different URL and back I can no longer navigate to any razor page. I do not know why.

The site breaks after these logs.

Microsoft.AspNetCore.Components.CascadingValue`1[Syncfusion.Blazor.Navigations.ToolbarItem]
02:43:34 [DBG][Microsoft.AspNetCore.Components.RenderTree.Renderer] Disposing component 460 of type Syncfusion.Blazor.Navigations.ToolbarItem
02:43:34 [DBG][Microsoft.AspNetCore.Components.RenderTree.Renderer] Disposing component 459 of type Syncfusion.Blazor.Navigations.ToolbarItem
02:43:34 [DBG][Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost] Disposing circuit 'GfrqdTODEuAensIfzCkNos7EPHgC3cX9ComywE8W4D8' succeeded.
02:43:34 [DBG][Microsoft.AspNetCore.Components.Server.CircuitDisconnectMiddleware] Circuit with id 'GfrqdTODEuAensIfzCkNos7EPHgC3cX9ComywE8W4D8' terminated gracefully.
02:43:34 [INF][Microsoft.AspNetCore.Routing.EndpointMiddleware] Executed endpoint 'Blazor disconnect'
02:43:34 [DBG][Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets] Connection id "0HMFRUPK7S99E" received FIN.
02:43:34 [DBG][Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets] Connection id "0HMFRUPK7S99E" sending FIN because: "The client closed the connection."
02:43:34 [DBG][Microsoft.AspNetCore.Server.Kestrel.Connections] Connection id "0HMFRUPK7S99E" disconnecting.
02:43:34 [DBG][Microsoft.AspNetCore.Server.Kestrel.Connections] Connection id "0HMFRUPK7S99E" completed keep alive response.
02:43:34 [INF][Microsoft.AspNetCore.Hosting.Diagnostics] Request finished HTTP/1.1 POST https://mninc.consulting/_blazor/disconnect multipart/form-data;+boundary=---------------------------139792296522211296111044067565 397 - 200 0 - 54.1590ms
02:43:34 [DBG][Microsoft.AspNetCore.Server.Kestrel.Connections] Connection id "0HMFRUPK7S99E" stopped.


Afterwards, the nav menu load fine and if I try to click any link these logs print. Which tells me that nginx is forwarding the requests to the blazor app but they aren't services correctly.

02:44:09 [VRB][Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport] Message received. Type: Binary, size: 26, EndOfMessage: True.
02:44:10 [VRB][Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport] Message received. Type: Binary, size: 3, EndOfMessage: True.



NGINX configuration

map $http_upgrade $connection_upgrade {
default Upgrade;
'' close;
}

upstream websocket {
server localhost:5001;
}

server {

root /var/www/example.com;

# Add index.php to the list if you are using PHP
index index.html;

server_name example.com www.example.com;

location / {
proxy_pass https://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection keep-alive;
#proxy_set_header Connection $connection_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

# proxy_buffering off;
# proxy_read_timeout 100s;
}

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate ****************************************************************************
ssl_certificate_key ****************************************************************************
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}
Related categories: System Admin Linux Network Administration Blazor