R Markdown with shiny backend

I have a RStudio Server (OS) behind an apache reverse proxy which I am using for collaborative development with a client. Most of the time things are working fine, in particular running Shiny applications and the terminal, which are sometimes difficult behind a reverse proxy, work without problems.

However, there are difficulties when running an R Markdown document with shiny backend, i.e. a document with

output: html_document
runtime: shiny

in the YAML header. Such documents work fine for me with a direct internet connection to the server using current FF. For my client, who has to use a corporate proxy with IE 11, these do not work. On running such a document with the "Run document" button he sees

Loading required package: shiny

Listening on<some_port>

in the "R Makrdown" tab, but after that the process stalls. In particular there is no progress output from rmarkdown.

Any idea how to debug this? Could it be that the corporate proxy filters out something?

After another talk with the client it has become clear that shiny apps aren't working properly either. They display the control elements, but the entire page is grayed-out. This applies to Shiny apps started via RStudio server and deployed in Shiny Server. So there is no special issue with R Markdown with shiny backend.

Did you figure out what the issue is? Is it a websocket issue within IE 11? Or maybe a websocket issue with the corporate proxy?

I initially thought there were a difference between using Shiny directly and via R Markdown, but that is not the case since pure Shiny is also affected. I have not identified the underyling reason, though. Any idea how to debug this?

Yeah, if Shiny immediately grays out when you open up the Shiny application, then websockets are almost certainly the issue. I don't completely understand the architecture you have here and whether the apache proxy is the same / etc.

What I would do is have the person w/ the broken Shiny applications open up their "Browser Devtools" and watch the networking traffic. The request to initiate websockets probably fails, which kills the Shiny application. Hopefully that will convey additional information, too. If not, the next step is to just dig into the different proxies between the user and RStudio Server to see what might be stopping the websocket traffic (look at logs, configuration, etc.). If all of the proxies work fine for other users, then the next step would be to dig into the client / client's computer and try to figure out if there is some type of client configuration (IE 11, etc.) that is preventing the websockets from working.

I hope that helps! I'm definitely curious to hear what you find!

1 Like

Thanks for the debugging tips. Let's see if I can teach my client to use the "Browser Devtools" ...

Here an overview of the set-up:

+----------------+                               +------------+
| RStudio Server | --+                       +-- | My Browser |
+----------------+   |   +---------------+   |   +------------+
                     +-- | Reverse Proxy | --+
  +--------------+   |   +---------------+   |   +--------------+     
  | Shiny Server | --+                       +-- | Client Proxy |
  +--------------+                               +--------------+
                                                | Client Browser |

So every connection has to pass through the reverse proxy (apache), but the client has an additional proxy in place. From reading https://docs.rstudio.com/shiny-server/#specifying-protocols I had assumed that websocket is replaced by some other protocol if the connection fails. But maybe I should give Ctrl+Alt+Shift+A (client side) or disable_protocols (server side) a try. Both seem to work only for shiny apps hosted on shiny server, though. Not for shiny apps running interactively in RStudio Server.

Thanks for the diagram! Pretty impressive ASCII diagram, I must say!!

Yes, you are spot on. Shiny Server and RStudio Connect can change how the Shiny application protocol, but (if I recall correctly) RStudio Server always uses websockets for its "developer" Shiny implementation. I'm not savvy enough to know the reasons for this :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.