• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

Can't retrieve ip address

Guest
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

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?

Views

2.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

I only have a router for a firewall. I used a site www.whatismyip.com and it gets it no problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

Yes running cf on my computer to test all cf applications.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

I needed to add the persons ip to this application to make sure they don't submit a vote twice (site i'm working on). So since this doesn't work locally i have to come up with another way.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 04, 2012 May 04, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 05, 2012 May 05, 2012

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation