SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Client-side redirect with HTTP headers control?

    Is there any way to redirect on the client-side, while being able to set HTTP request headers?

    I tried using this function:
    http://www.faqts.com/knowledge_base/...d/12039/fid/51

    But that is server-side, and thus makes it look like the visitor has the server's IP address. I want the client side's IP address to be used, not the server's.

  2. #2
    get into it! bigduke's Avatar
    Join Date
    May 2004
    Location
    Australia
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use $_SERVER['REMOTE_ADDR'] to get the client's IP and force a redirect but this would work only for clients on WAN IP, not possible for clients behind a VPN or LAN

  3. #3
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know how to get an IP, and I'm not sure what you mean by using it to redirect.

    It is the page I am redirecting to that I'm concerned with. With a regular redirect, the page that you are redirecting to will show information of the client (the web surfer's IP and such). However with a regular redirect you cannot control the HTTP request headers.

    The above function allows a redirect and control of HTTP request headers, however it is server-side. The server's IP address (the server that is hanling the redirect) will be shown as the IP address of the user; not the actual user's IP. The page being redirected to will think the server is visiting the site, not the user.

    Perhaps an example would help:
    • A User with IP Addresss ABC visits Redirect.com (which has IP Address SER)
    • Redirect.com redirects to SomeDomain.com using the function above, with headers passed to it (such as POST variables and User-Agent information)
    • SomeDomain.com gets the headers OK, but now thinks it has just been visited from IP Address SER (SomeDomain.com's $_SERVER['REMOTE_ADDR'] will return "SER", not "ABC"). It does not know it has been visited by someone from IP Address ABC.


    I'm looking for something that can pass request headers, but will still tell the end domain the client's IP, not the server's. As far as I know this means a client-side redirection, but I don't know of anything client-side than pass headers. Is there such a thing? Or is there some server-side redirect that can do this?

  4. #4
    SitePoint Guru dbevfat's Avatar
    Join Date
    Dec 2004
    Location
    ljubljana, slovenia
    Posts
    684
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One possibility is that your Redirect.com generates a html form with all POST values it receives. Then it auto-submits the form. This way, you get a request from ABC on server SomeDomain.com, along with all POST values.

    But this could _only_ work for POST/GET. You have no control on what the browser sends as User-Agent, cookies, referer (this one in particular will hold the original SER address).

  5. #5
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's the headers I care about though. Otherwise it would be easy.

  6. #6
    SitePoint Guru dbevfat's Avatar
    Join Date
    Dec 2004
    Location
    ljubljana, slovenia
    Posts
    684
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No can do then. Basically, what you want is an explot, so it's a good thing it cannot be done.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •