通过反向代理运行的Shiny-Server应用在本地网络外部无响应

时间:2019-07-16 22:47:23

标签: r shiny reverse-proxy shinydashboard shiny-server

我一直在尝试设置通过代理运行的闪亮服务器,以便可以通过SSL(https)保护应用程序。为此,我需要进行以下设置:

  • 主机服务器是运行HyperV和IIS的Windows Server 2016
  • 我有一个在HyperV上作为VM运行的Ubuntu Desktop 18.04实例
  • 我正在Ubuntu VM上运行Shiny-Server的开源版本

基本上在Windows Server上的IIS中,我有一个网站设置为将传入的https请求路由到Shiny-Server。从Windows Server连接到应用程序时,这非常有用,即使使用https域名连接,一切也都按预期运行。

但是,当我从本地网络外部连接时,该应用程序会加载,但完全没有响应。我使用软件包shinyauthr来提供对应用程序的非常简单的登录,并且从Windows Server打开网站时,整个登录过程都可以正常工作,但是当我从网络外部打开应用程序时单击登录时,则没有任何作用发生。奇怪的是withProgress()加载程序仍然出现?而且,该应用程序永远不会变灰,它只会反复闪烁“尝试重新连接”一秒钟。请参见以下屏幕截图:

Login Page Showing Progress
Login Page Showing Attempting to Reconnect

我的Shiny-Server配置如下:

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
app_init_timeout 600;
app_idle_timeout 0;
sanitize_errors off;
disable_protocols xdr-streaming xhr-streaming iframe-eventsource iframe-htmlfile;

# Define a server that listens on port 3838
server {
  listen 3838;

  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

1 个答案:

答案 0 :(得分:0)

我找到了答案,这有点令人尴尬...

我在同一台Windows Server上运行了另一个旧网站,该网站试图使用相同的端口,因此它正在与闪亮的服务器争夺流量。在为旧网站分配新端口后,一切运行正常:)