[dancer-users] ip addess

Hugues hugues at max4mail.com
Wed Apr 22 12:01:43 BST 2015


Thanks Paulo and Stefan

I change my code to:

my $ip;

                 if ( request->remote_address() eq "127.0.0.1" ) {
                         $ip = request->header('x-forwarded-for');
                 } else {
                         $ip = request->remote_address();
                 }

                 debug "My ip : ". $ip;


it's ok now

[110804] debug @0.260742> [hit #34]My ip : 192.168.0.19 in /home/git/

I try with and without

behind_proxy: true

I don't see difference

thanks
Hugues


Le 22/04/2015 12:15, Stefan Hornburg (Racke) a écrit :
> On 04/22/2015 09:45 AM, Hugues wrote:
>> Hello
>> I move my Dancer app from wpsgi to " starman + apache proxy"
>>
>> in my code, I registered client ip address with
>>
>> my $ip               = request->remote_address();
>>
>>
>> now, Ip address is always 127.0.0.1
>>
>> see my apache config
>>
>> <VirtualHost *:80>
>>      ServerName admin.web.com
>>      DocumentRoot /home/web/
>>      HostnameLookups Off
>>      UseCanonicalName Off
>>      ProxyPreserveHost On
>>
>>      ProxyPass bootstrap !
>>      ProxyPass fontawesome !
>>      ProxyPass images !
>>      ProxyPass javascripts !
>>      ProxyPass css !
>>      ProxyPass / http://localhost:5002/ retry=0 Keepalive=on
>>      ProxyPassReverse / http://localhost:5002/
>>      TimeOut 300
>>      <Proxy *>
>>         Order allow,deny
>>         Allow from all
>>      </Proxy>
>> </VirtualHost>
>>
>>
>> how I can get client Ip adress  from my Dancer code ?
>> thanks
>> Hugues.
> Did you set behind_proxy in configuration?
>
> Regards
>            Racke
>
>



More information about the dancer-users mailing list