0

I wrote a shiny web application and deploy it on a server using ShinyProxy. Accessing the app directly via the IP address and port 8080 works fine. However, I need to connect it to a URL. On the ShinyProxy website there is an explanation on how it works with Nginx:

server {
  listen                80;
  server_name           shinyproxy.yourdomain.com;
  rewrite     ^(.*)     https://$server_name$1 permanent;
}

server {
  listen                443;
  server_name           shinyproxy.yourdomain.com;
  access_log            /var/log/nginx/shinyproxy.access.log;
  error_log             /var/log/nginx/shinyproxy.error.log error;

  ssl on;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

  ssl_certificate       /etc/ssl/certs/yourdomain.com.crt;
  ssl_certificate_key   /etc/ssl/private/yourdomain.com.key;

   location / {
       proxy_pass          http://127.0.0.1:8080/;

       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_read_timeout 600s;

       proxy_redirect    off;
       proxy_set_header  Host             $http_host;
       proxy_set_header  X-Real-IP        $remote_addr;
       proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
       proxy_set_header  X-Forwarded-Proto $scheme;
     }

}

Unfortunately, I need to use Apache, i.e. Apache/2.4.43 (Debian). I tried various configurations, but I do not get it to work. Simply connecting the target URL to the port on the server allows me to load the app in the first place. Though after loading the app, the screen immediately turns grey and the app unresponsive. That happens because simply linking a URL to an IP address does not correctly account for the use of web sockets.

Does anyone know what the correct Apache file should look like? How do I connect the app, which does not require user autentication, to a URL (e.g. the above mentioned shinyproxy.yourdomain.com)?

I posted the question on Stack Overflow some days ago, but did not receive any answers or comments.

Chr
  • 103
  • 3
  • You'd probably need to `Upgrade` your HTTP `1.1` `Connection` to allow WebSocket using [`mod_proxy_wstunnel`](https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html) connection. Could you add your Apache2 version and your current configurations in your question? – mforsetti Aug 08 '20 at 17:27
  • Thanks for the comment. I did not know that I had to load mod_proxy_wstunnel. It now works. – Chr Aug 10 '20 at 13:11
  • sure, glad you fixed that. – mforsetti Aug 10 '20 at 13:20

0 Answers0