EvanK has asked for the wisdom of the Perl Monks concerning the following question:

I'm making sort of a proxy-type thing. Someone accesses my script in a web browser, and the script in turn sends a POST request by way of LWP::UserAgent. Now, is there any way that i can have the recipient of the POST request see the ip of the person who's accessing my script instead of whatever ip they would normally see? (which i'm guessing is the server's ip).

______________________________________________
RIP
Douglas Noel Adams
1952 - 2001

Replies are listed 'Best First'.
Re: Faking an ip?
by arhuman (Vicar) on Jul 08, 2001 at 13:02 UTC
    Here are some common vars sometime used by proxy to transmit the IP address :

    • REMOTE_ADDR (Most common)
    • FORWARDEDPROXY_CON
    • CLIENT_IP
    • X_LOCK
    • HTTP_X_FORWARDED_FOR

    There are probably others...


    "Only Bad Coders Code Badly In Perl" (OBC2BIP)
      Actually, REMOTE_ADDR is handled by the server (address resolving). AFAIK there is no way of safely/properly changing it. The changes for the other values in your list are much higher :)

      Greetz
      Beatnik
      ... Quidquid perl dictum sit, altum viditur.
      Thanks! I only knew about the HTTP_X_FORWARDED_FOR, and never really bothered to find out more, but this can certainly provide me with more accuracy for my program, which uses IPs as a backup method to distinguish between various users (cookies being the primary method).
        IPs are not a reliable way to distinguish users or sessions. AOL users, for instance, can use a different IP for each page request. Cookies aren't perfect, but they're better than IPs.

        Credit where it's due: Merlyn made a similar post a couple days ago.

        --
        man with no legs, inc.
Re: Faking an ip?
by John M. Dlugosz (Monsignor) on Jul 08, 2001 at 21:26 UTC
    My anonomiser lists HTTP_VIA (primary for proxy detection), HTTP_FORWARDED, HTTP_USER_AGENT_VIA, HTTP_CACHE_INFO, HTTP_CACHE_CONTROL, and HTTP_(PROXY-)CONNECTION:close as variables that proxies might be using.

    It also has HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR_IP as things it can add itself.