mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-11 07:58:11 -05:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71d20d3561 | ||
|
|
32ac62f2a3 |
45
R/shiny.R
45
R/shiny.R
@@ -2126,6 +2126,51 @@ ShinySession <- R6Class(
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getUrl = function() {
|
||||
req <- self$request
|
||||
|
||||
url <-
|
||||
# Connect
|
||||
req[["HTTP_X_RSC_REQUEST"]] %||%
|
||||
req[["HTTP_RSTUDIO_CONNECT_APP_BASE_URL"]] %||%
|
||||
# ShinyApps.io
|
||||
if (!is.null(req[["HTTP_X_REDX_FRONTEND_NAME"]])) {
|
||||
paste0("https://", req[["HTTP_X_REDX_FRONTEND_NAME"]])
|
||||
}
|
||||
|
||||
if (is.null(url)) {
|
||||
forwarded_host <- req[["HTTP_X_FORWARDED_HOST"]]
|
||||
forwarded_port <- req[["HTTP_X_FORWARDED_PORT"]]
|
||||
|
||||
host <- if (!is.null(forwarded_host) && !is.null(forwarded_port)) {
|
||||
paste0(forwarded_host, ":", forwarded_port)
|
||||
} else {
|
||||
req[["HTTP_HOST"]] %||% paste0(req[["SERVER_NAME"]], ":", req[["SERVER_PORT"]])
|
||||
}
|
||||
|
||||
proto <- req[["HTTP_X_FORWARDED_PROTO"]] %||% req[["rook.url_scheme"]]
|
||||
|
||||
if (tolower(proto) == "http") {
|
||||
host <- sub(":80$", "", host)
|
||||
} else if (tolower(proto) == "https") {
|
||||
host <- sub(":443$", "", host)
|
||||
}
|
||||
|
||||
url <- paste0(
|
||||
proto,
|
||||
"://",
|
||||
host,
|
||||
req[["SCRIPT_NAME"]],
|
||||
req[["PATH_INFO"]]
|
||||
)
|
||||
}
|
||||
|
||||
# Strip existing querystring, if any
|
||||
url <- sub("\\?.*", "", url)
|
||||
|
||||
url
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -30,7 +30,10 @@ expression that produces a Shiny app object.
|
||||
\item{port}{The TCP port that the application should listen on. If the
|
||||
\code{port} is not specified, and the \code{shiny.port} option is set (with
|
||||
\code{options(shiny.port = XX)}), then that port will be used. Otherwise,
|
||||
use a random port.}
|
||||
use a random port between 3000:8000, excluding ports that are blocked
|
||||
by Google Chrome for being considered unsafe: 3659, 4045, 5060,
|
||||
5061, 6000, 6566, 6665:6669 and 6697. Up to twenty random
|
||||
ports will be tried.}
|
||||
|
||||
\item{launch.browser}{If true, the system's default web browser will be
|
||||
launched automatically after the app is started. Defaults to true in
|
||||
|
||||
@@ -19,7 +19,10 @@ list the available examples.}
|
||||
\item{port}{The TCP port that the application should listen on. If the
|
||||
\code{port} is not specified, and the \code{shiny.port} option is set (with
|
||||
\code{options(shiny.port = XX)}), then that port will be used. Otherwise,
|
||||
use a random port.}
|
||||
use a random port between 3000:8000, excluding ports that are blocked
|
||||
by Google Chrome for being considered unsafe: 3659, 4045, 5060,
|
||||
5061, 6000, 6566, 6665:6669 and 6697. Up to twenty random
|
||||
ports will be tried.}
|
||||
|
||||
\item{launch.browser}{If true, the system's default web browser will be
|
||||
launched automatically after the app is started. Defaults to true in
|
||||
|
||||
Reference in New Issue
Block a user