Skip to content

Commit

Permalink
Setting the referer to HTTP_HOST when URI is HTTP_REFERER is not prov…
Browse files Browse the repository at this point in the history
  • Loading branch information
meztez committed Jun 11, 2019
1 parent 6e3417e commit 4794a00
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/plumber.R
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,12 @@ plumber <- R6Class(
# use the HTTP_REFERER so RSC can find the swagger location to ask
## (can't directly ask for 127.0.0.1)
referrer_url <- req$HTTP_REFERER
referrer_url <- sub("index\\.html$", "", referrer_url)
referrer_url <- sub("__swagger__/$", "", referrer_url)
if (is.null(referrer_url)) {
referrer_url <- paste0("http://", req$HTTP_HOST, "/")
} else {
referrer_url <- sub("index\\.html$", "", referrer_url)
referrer_url <- sub("__swagger__/$", "", referrer_url)
}
spec$servers <- list(
list(
url = referrer_url,
Expand Down

0 comments on commit 4794a00

Please sign in to comment.