Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: REMOTE_ADDR not working

by rowdog (Curate)
on Jan 30, 2011 at 04:21 UTC ( #885096=note: print w/replies, xml ) Need Help??

in reply to REMOTE_ADDR not working

I haven't ever dealt with Amazon and I don't know much about web proxies but it sounds like you're getting a proxy address for all the requests. Maybe Amazon is running a reverse proxy?

Well, if I'm right, there should be other headers you can use. One way to check would be to dump %ENV and see if you find any proxy headers.

Replies are listed 'Best First'.
Re^2: REMOTE_ADDR not working
by chrestomanci (Priest) on Jan 30, 2011 at 19:58 UTC

    Most likely Amazon are running a load balancer, so that if you have multiple machines running the same http server, the load gets shared between them automatically. It also allows Amazon to save on public routeable IP addresses, which as we know are becoming a scarce resource.

    As others have said, you need to examine the headers, to look for one that contains the original IP address. Most likey it will be HTTP_X_FORWARDED_FOR, but it is entirely possible that Amazon have decided to do their own thing.

    The other thing to be aware of is that your clients will most likely be behind a proxy from their ISP, so you are unlikely to see their real IP address. If you are lucky, the proxy at the client end will also have put the IP address in a special header. The other possibility is that both proxies put the IP addresses in HTTP_X_FORWARDED_FOR, to create a comma separated list of IP addresses.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://885096]
[atcroft]: james28909: That particular questions was a bit of trick, actually (depending on the country you are in). More interesting is, if you are trying to subtract from an epoch time, for instance, you might have to consider when/if DST occurs for a location,
[atcroft]: because you may have to adjust the number of seconds you change from an epoch from 86400 (not to mention leap seconds)....
[atcroft]: james28909: Although if your program is using a database, you might be able to "pass the buck" to the database and ask it to do the date change for you....
[stevieb]: ++ atcroft

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2017-04-29 04:40 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (531 votes). Check out past polls.