Luke
Luke

Reputation: 61

Run shinyapp in https mode

I want deploy my app with shiny using command shiny::runApp(). My question is if it's possible to do this use https instead of http (I can't install shiny server).

Now I run in this mode: shiny::runApp("app.R", port=3090, host="myipaddress"). I have a domain that point in the ip address and if I write in browser: http://mydomain:3090 works correctly.

My problem is that I can't find any mode to switch from http://mydomain:3090 to https://mydomain:3090.

Any help is appreciated

Upvotes: 4

Views: 3626

Answers (1)

Luke
Luke

Reputation: 61

As suggest Sergio Romero I have used reverse proxy on apache on port 443 and handle ssl certificate. I followed this guide to setting configuration of Virtual Host on Apache

<VirtualHost *:443>
  ServerName mydomainname

  <Proxy *>
    Allow from mydomainname
  </Proxy>

  RewriteEngine on
  RewriteCond %{HTTP:Upgrade} =websocket
  RewriteRule /(.*) ws://mydomainname:myport/$1 [P,L]
  RewriteCond %{HTTP:Upgrade} !=websocket
  RewriteRule /(.*) http://mydomainname:myport/$1 [P,L]

  ProxyPass / http://mydomainname:myport/
  ProxyPassReverse / http://mydomainname:myport/
  ProxyRequests Off

  ## SSL directives
  SSLEngine on
  SSLCertificateFile      "path_to_cert.pem"
  SSLCertificateKeyFile   "path_to_privkey.pem"
  SSLCertificateChainFile "path_to_fullchain.pem"
</VirtualHost>

Upvotes: 2

Related Questions