upstream api_upstream {
    keepalive 30;
    server    backend:3001;
}

server {
    listen       80;
    server_name  _;
    root   /usr/share/nginx/html;

    location / {
        try_files $uri @index;
    }

    location @index {
        add_header Cache-Control no-cache;
        expires 0;
        try_files /index.html =404;

        index  index.html index.htm;
    }

    location /socket.io {
        proxy_pass http://api_upstream;
        proxy_pass_request_headers on;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
