Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET 5 behind nginx

I have a ASP.NET 5 MVC6 application behind a Nginx server that acts as a reverse proxy. Its configuration is :

server {
    listen       80;
    server_name  example.com;

    location / {
            proxy_pass   http://localhost:5000;
            client_max_body_size 50M;
            proxy_set_header Host $host;
    }
 }

It was working very well on Linux until the ASP.NET 5 RC1. Since then, and on Windows before that, the requests to MVC 6 controllers would fail: I see the response but the browser continues to load as if the response was not complete (static files are served correctly). A direct request to http://localhost:5000/api/xxx responds and closes immediatly.

I tried to add proxy_buffering off but it had no effect. I suspect that it is related to the chunked mode but I found nothing online about this.

like image 535
Sidoine Avatar asked Nov 21 '15 17:11

Sidoine


1 Answers

This is a known issue in rc1. The current work around is to add the following to your nginx configuration;

proxy_set_header Connection keep-alive;

Fix is scheduled for rc2.

like image 136
Stafford Williams Avatar answered Oct 02 '22 20:10

Stafford Williams