Request freezes for nginx reverse proxy for ASP.NET 5 web application on docker

I am trying to get nginx, ASP.NET 5, Docker and Docker Compose to work together on my development environment, but I don’t see it working yet. This is the state in which I am currently living, and let me briefly explain here as well.

I have the following docker-compose.yml file:

webapp:
  build: .
  dockerfile: docker-webapp.dockerfile
  container_name: hasample_webapp
  ports:
    - "5090:5090"

nginx:
  build: .
  dockerfile: docker-nginx.dockerfile
  container_name: hasample_nginx
  ports:
    - "5000:80"
  links:
    - webapp:webapp

docker-nginx.dockerfile file:

FROM nginx
COPY ./nginx.conf /etc/nginx/nginx.conf

and docker-webapp.dockerfile:

FROM microsoft/aspnet:1.0.0-rc1-update1

COPY ./WebApp/project.json /app/WebApp/
COPY ./NuGet.Config /app/
COPY ./global.json /app/
WORKDIR /app/WebApp
RUN ["dnu", "restore"]
ADD ./WebApp /app/WebApp/

EXPOSE 5090
ENTRYPOINT ["dnx", "run"]

nginx.conf file:

worker_processes 4;

events { worker_connections 1024; }

http {
    upstream web-app {
        server webapp:5090;
    }

    server {
      listen 80;

      location / {
        proxy_pass http://web-app;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
      }
    }
}

Everything is fine, and when I start docker-compose up, it starts and starts two containers, which is also nice. From the host, when I click localhost:5000, the request simply hangs, and when I complete the request, nginx writes a record through dockers indicating the 499HTTP response .

Any idea what I'm missing here?

Update:

ASP.NET 5, localhost: 5000, , ASP.NET 5, , 200 . nginx , .

enter image description here

+4
1

Kestrel RC1: https://github.com/aspnet/KestrelHttpServer/issues/341

, Connection: keep-alive:

proxy_set_header Connection keep-alive;
+2

Source: https://habr.com/ru/post/1624526/


All Articles