在已发布的 bookdown 书中包含托管在私人服务器中的 Shiny 应用程序

Including a Shiny app hosted in a private server in a published bookdown book

我在尝试做我认为很简单的事情时遇到了问题:用托管在 AWS EC2 服务器上的相同应用程序替换托管在 https://www.shinyapps.io/ 中的 Shiny 应用程序。

我之前的(工作正常,但 运行 超时)是:

```{r, echo = FALSE, screenshot.opts = list(delay = 15), dev = 'png', 
cache = TRUE, fig.align = 'center', out.width = '90%'}
knitr::include_app('http://user.shinyapps.io/least-squares/', height = 
'900px')
```

我在尝试什么:

```{r, echo = FALSE, screenshot.opts = list(delay = 15), dev = 'png', 
cache = TRUE, fig.align = 'center', out.width = '90%'}
knitr::include_app('http://ec2-35-177-34-200.eu-west-
2.compute.amazonaws.com:3838/least-squares/', height = '900px')
```

您可以看到该应用确实 运行ning 在

中应该如此

http://ec2-35-177-34-200.eu-west-2.compute.amazonaws.com:3838/least-squares/ [编辑:现已禁用]

此外,第二段代码生成 html 充分显示本地应用程序的文档(它们是从 .Rmd 文件生成的)。当本书出版到 http://bookdown.org 时,问题就来了;如果我使用第二段代码(第一段没问题),应用程序不会显示。

知道发生了什么事吗?

您不能在通过 HTTPS 提供的网页上使用 HTTP 资源。有关详细信息,请参阅此 post:

您在 ShinyApps.io 上托管的应用程序运行正常,因为它是通过 HTTPS 提供的。