Thanks but app->environment().clientAddress() is still returning the
servers IP address, I put this under the frontend, is that correct?

frontend wt

    bind 108.59.251.28:80 # I have two IP address (SSL)
    option http-server-close  
    reqidel ^Client-IP:.*
    reqidel ^X-Forwarded-For:.*
    option forwardfor

> I dunno what http-server-close is needed for, maybe it is unrelated
here.
>> from link below: BTW, you should replace "option httpclose" with
"option http-server-close", it will enable keep-alive with the clients
and reduce the page load time for those who experience a high latency.
also see http://www.serverphorums.com/read.php?10,357873 

I tried it without the option http-server-close, no difference, I did
this on two Ubuntu 12.04 LTS servers, with haproxy 1.4 and 1.5 on the
other, both with Wt 3.3.3.

does app->environment().clientAddress() return the correct IP address
for you?

I am using wthttpd only.

Thanks
Jeff Flesher

On Sun, 2014-07-20 at 02:25 +0400, Nagaev Boris wrote:

> Hello!
> 
> I used to add these lines to my haproxy config:
>     reqidel ^Client-IP:.*
>     reqidel ^X-Forwarded-For:.*
>     option http-server-close
>     option forwardfor
> and it worked.
> 
> First two lines remove headers Client-IP and X-Forwarded-For passed by
> a user (not to confuse Wt webserver), 4-th line sets  real IP to
> X-Forwarded-For header. I dunno what http-server-close is needed for,
> maybe it is unrelated here.
> 
> Nowdays I use nginx with following config line:
>     proxy_set_header X-Forwarded-For $remote_addr;
>     proxy_set_header Client-IP "";
> 
> Client-IP is set to empty string to prevent Wt confusion in case user
> passes smth in Client-IP.
> 
> -
> Best regards,
> Boris Nagaev
> 
> 
> On Sun, Jul 20, 2014 at 2:04 AM, Jeffrey Scott Flesher Gmail
> <jeffrey.scott.fles...@gmail.com> wrote:
> > Nagaev Boris mentioned using a Gather Class which uses flash
> > http://starius.ru/wt-classes/reference/classWt_1_1Wc_1_1Gather.html#_details
> > All I need is the users IP address, and I do not want to use flash, since it
> > may not be loaded on the users system, I do not have it loaded, and I am
> > sure a lot of others do not like it as well.
> >
> > This is only returning the servers IP address
> >
> > app->environment().clientAddress()
> >
> > Reading this:
> > Returns the IP address of the client.
> > The (most likely) IP address of the client that is connected to this
> > session.
> > This is taken to be the first public address that is given in the Client-IP
> > header,
> > or in the X-Forwarded-For header (in case the client is behind a proxy).
> > If none of these headers is present, the remote socket IP address is used.
> >
> > I got the idea that its something I need to change in my haproxy config, but
> > not sure what:
> > I have this set:
> > option forwardfor
> >
> > and played with these settings also:
> > option httpclose
> > option  http-server-close
> > even
> > option forceclose
> >
> > I even tried reqidel ^X-Forwarded-For: after reading a post:
> > http://serverfault.com/questions/437088/haproxy-not-properly-passing-on-x-forwarded-for-header
> > and reqidel ^X-Forwarded-For:.* after reading:
> > http://serverfault.com/questions/358939/overriding-the-x-forwarded-for-header-in-haproxy
> > It didn't help.
> >
> > Can anyone tell me if this is an haproxy issue or is there another way to
> > get the users IP address?
> >
> > Thanks
> > Jeff Flesher
> >
> >
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to