Re: Include client IP address in rewritten URL

From: Anze <anzenews#volja.net>
Date: Tue, 14 Dec 2010 08:04:27 +0100

This might be obvious, but still:
all of the programming languages I know of can access REMOTE_ADDR even if they don't get it via GET vars. For instance, in PHP you can get it from $_SERVER['REMOTE_ADDR']. So there should be no need to use GET vars, just change the way you access the data. The change should be trivial.

If the code is not yours and you are not allowed to change it, there could still be some way to fix this. For instance, in PHP you could try autoprepending this code:
<?php
  $_REQUEST['REMOTE_ADDR'] = $_GET['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; ?>
That's ugly, of course, but it should still be much faster than Apache rewrite.

YMMV. Anze

On Tuesday 14 December 2010, Willy Tarreau wrote:
> Hi Shawn,
>
> On Mon, Dec 13, 2010 at 07:29:20PM -0700, Shawn Heisey wrote:
> > I am trying to use haproxy 1.4.8 to replace an apache URL rewriting
> > engine that crumbles under load. I have to duplicate the following part
> > of it:
> >
> > &ipaddr=%{REMOTE_ADDR}
> >
> > The IP address is not part of the original URL, but it must be included
> > in the rewritten one. Looking at the documentation, I cannot figure out
> > how to do this. Can anyone help?
>
> You can't with current version. A variable-based system is planned for
> version 1.5, but its development has not started yet so I doubt we'd
> get anything by the end of the year :-/
>
> Regards,
> Willy
Received on 2010/12/14 08:04

This archive was generated by hypermail 2.2.0 : 2010/12/14 08:15 CET