aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Blazor SSR stream rendering not working when i deploy to nginx server on linux

Open sardar97 opened this issue 9 months ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

when I run the app on localhost stream rendering works fine with ssr rendering but when I deploy it to nginx server on linux it is not Working !.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

.net v8.0.204

Anything else?

No response

sardar97 avatar May 10 '24 18:05 sardar97

@sardar97 thanks for contacting us.

Check that you are not buffering the response on nginx. If the server buffers the response before sending it back it will prevent streaming rendering from having an effect.

javiercn avatar May 11 '24 09:05 javiercn

this is my site-enabled config please let me know if it is wrong or it is make buffering on! and shall i share nginx.conf as well?

 
server {


        server_name sardarqaslany.com *.sardarqaslany.com;

         location / {
                proxy_pass         http://localhost:5001/;
                proxy_http_version 1.1;
                proxy_set_header   Upgrade $http_upgrade;
                proxy_set_header   Connection $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;
        }



    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/sardarqaslany.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/sardarqaslany.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}
server {
    if ($host = www.sardarqaslany.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = sardarqaslany.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot




        server_name sardarqaslany.com *.sardarqaslany.com;
    listen 80;
    return 404; # managed by Certbot




}

 

sardar97 avatar May 12 '24 11:05 sardar97

@sardar97 thanks for the additional details.

Unfortunately, we aren't nginx experts and can't help with this request. We suggest you ask on stack overflow or the nginx docs on how buffering works in nginx in particular.

javiercn avatar May 13 '24 16:05 javiercn

but this is Stream Rendering issue have you tried with nginx? and dotnet 8? this is something i yhink microsoft should test before even release!

sardar97 avatar May 13 '24 16:05 sardar97

One pattern we observed is that customers who discovered that it's not working had some buffering configuration enabled on their servers / proxies. See if this helps: https://learn.microsoft.com/en-us/aspnet/core/signalr/scale?view=aspnetcore-8.0#linux-with-nginx

mkArtakMSFT avatar May 13 '24 16:05 mkArtakMSFT

Hi @sardar97. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

thank u very much @mkArtakMSFT I fixed it by adding this proxy_buffering off;

sardar97 avatar May 14 '24 14:05 sardar97