I maintain a Dockerised shiny R hosted in Ubuntu with Ngnix web-server running in port 5050. It works fine, however greyed out after inactivity for some time.
To circumvent this I modified the proxy_read_timeout
parameter default
file in /etc/nginx/sites-available
as below
location /XXX/YYY/ {
rewrite ^/XXX/YYY/(.*)$ /$1 break;
proxy_pass http://localhost:5050;
proxy_redirect http://localhost:5050/ $scheme://$host/XXX/YYY/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 20d;
proxy_buffering off;
}
I also increased numbers in all below files
/proc/sys/net/ipv4/tcp_keepalive_time
/proc/sys/net/ipv4/tcp_keepalive_intvl
/proc/sys/net/ipv4/tcp_keepalive_probes
/proc/sys/net/ipv4/tcp_retries2
Additionally, I added below lines /etc/nginx/nginx.conf
http {
fastcgi_read_timeout 1d;
proxy_read_timeout 1d;
}
Furthermore, I added below lines of code in server.R
output$clock = renderText({
invalidateLater(5000)
Sys.time()
})
But unfortunately, nothing solved my problem. However I noticed that when I use ip-address:5050 to run my app I don't see greyed out, but when I use ip-address/XXX/YYY then it happens.
I am using Cloudflare
free subscription - dose it have any impact on above issue? If this is the case then what is the solution?