Is the user's IP address someplace in session$clientData?

442 views
Skip to first unread message

Alex Bokov

unread,
Nov 1, 2013, 6:09:35 PM11/1/13
to shiny-...@googlegroups.com
I would like to have a poll feature, and I would like to correct for multiple voting by linking votes to IP addresses. Then, I would only count the last vote from each IP.

In which object in session$clientData should I look for the IP address?

Thanks

Claude Boivin

unread,
Jan 23, 2014, 2:20:42 PM1/23/14
to shiny-...@googlegroups.com
Hello,

I am relatively new to Shiny and I would also like to have a poll feature. I have found an answer from Joe Cheng to a post from Dong Shichao (records, 27/7/2013).

 Here is what I have tried:

in ui.R:
    h3("URL components"),
    verbatimTextOutput("urlText")

in server.R:
 output$urlText <- renderText({
    paste(sep = "",
          "protocol: ", session$clientData$url_protocol, "\n",
          "hostname: ", session$clientData$url_hostname, "\n",
          "pathname: ", session$clientData$url_pathname, "\n",
          "port: ",     session$clientData$url_port,     "\n",
          "search: ",   session$clientData$url_search,   "\n",
          "IP address XFF: ", session$request$HTTP_X_FORWARDED_FOR,   "\n",
          "IP address: ", session$request$REMOTE_ADDR
    )
  })

I have obtained an IP address in session$request$REMOTE_ADDR, but it is not my IP address. It looks like a phony address. 

Claude
Reply all
Reply to author
Forward
0 new messages