Skip navigation
Currently Being Moderated

Can't retrieve ip address

May 4, 2012 7:45 AM

I trying to get a persons ip address using  <cfoutput>#cgi.REMOTE_ADDR#</cfoutput>, but all i'm getting is 0:0:0:0:0:0:0:1.Anyone know why and a better why to get it?

 
Replies
  • Currently Being Moderated
    May 4, 2012 7:49 AM   in reply to K0rrupt

    Do you have a firewall or other traffic management device between you and the outside world which might be routing external traffic onto an internal network? 

     

    Check to see if this returns anything useful:

    GetHttpRequestData().headers["X-Forwarded-For"]

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 7:51 AM   in reply to K0rrupt

    That's localhost in IPv6 is it not? Are you running CF locally?

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 8:00 AM   in reply to K0rrupt

    In which case that's probably correct and it should work when you put it live. As I say, that's localhost in IPv6.

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 8:11 AM   in reply to K0rrupt

    Well to be clear - it *does* work locally - it's giving you the IP address of the client; it just happens that's localhost. You shouldn't redesign your entire application just because it doesn't work in this one case.

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 8:36 AM   in reply to Owain North

    You shouldn't redesign your entire application just because it doesn't work in this one case.

     

    Or indeed because it does work in this case.

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2012 6:41 AM   in reply to K0rrupt

    K0rrupt wrote:

     

    I trying to get a persons ip address using  <cfoutput>#cgi.REMOTE_ADDR#</cfoutput>, but all i'm getting is 0:0:0:0:0:0:0:1.Anyone know why and a better why to get it?

    You have yet to respond to Owain's IPv6 remark. I hope you are now convinced that 0:0:0:0:0:0:0:1 is actually the localhost IP. That is, it is the same address as 127.0.0.1, but then in IPv6 notation. Your computer is the only localhost. You can therefore safely assume that CGI.REMOTE_ADDR will return the IP address of other client computers out of your domain.

     

    Message was edited by BKBK

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points