My question is : How this Shiny R code mini web server in JupyterHub could work outside this server (i.e. <> localhost) ?
ui <- fluidPage(
textInput("caption", "Caption", "Data Summary"),
verbatimTextOutput("value")
)
server <- function(input, output) {
output$value <- renderText({ input$caption })
}
shinyApp(ui, server)
Listening on http://127.0.0.1:4844
It works on the local server (127.0.0.1:4844) , but I doesn’t work on http://192.168.x.x:4844
For information. I’ve installed Jupyter and Jupyter Hub, with R Kernel, on Ubuntu 16.04 xenial. I’ve also installed Shiny Server and RStudio Server. Everything works fine. My firewall is off and I have Apache2.
I’ve seen this error on an other mini web server called from Jupyterhub in other mean that Shiny. The same code works in Rstudio Server IDE.
The problem is in the configuration of Jupyter Hub or Shiny Server or in Apache 2 or elsewhere ?
“You are using Jupyter notebook. The version of the notebook server is: 5.4.0
The server is running on this version of Python: Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) [GCC 7.2.0])”.
Thanks in advance.
2
Answers
From @greg L comment. With
ShinyApp()
wrapped inRunApp()
withhost="0.0.0.0"
.gave
With
http://192.168.x.x:my_port
Shiny apps listen on 127.0.0.1 (localhost) by default, which only the local machine can access. To make an app accessible to other machines, you can set the
host
option to0.0.0.0
:or
See https://shiny.rstudio.com/reference/shiny/latest/runApp.html for more details.