R/client.ip.R

Defines functions client.ip

Documented in client.ip

##' Return client IP address
##'
##' This is the "X-Forwarded-For" header, if available, and otherwise the "remote_ip" component of the global SERVER variable
##' @title client.ip
##' @return \code{SERVER$remote_ip}
##' @author Brad Friedman
##' @examples
##' SERVER <<- list(remote_ip = "127.0.0.1")
##' client.ip()
##' @export
client.ip <- function()  {
  shi <- SERVER$headers_in
  if(!is.null(shi))  {
    xff <- shi$`X-Forwarded-For`
    if(!is.null(xff))  return(xff)
  }
  return(SERVER$remote_ip)
}

Try the AnalysisPageServer package in your browser

Any scripts or data that you put into this service are public.

AnalysisPageServer documentation built on April 28, 2020, 6:32 p.m.