[dancer-users] ip addess

Paulo A Ferreira paulo.a.ferreira at gmail.com
Wed Apr 22 11:12:19 BST 2015


I don't use Apache as a reverse proxy so please test with "x-forward-for"
and "x-real-ip"

With Dancer1 you could use something like this:

hook 'before' => sub {

    if ( request->header('x-real-ip') ) {
        var ipaddress => request->header('x-real-ip');
    } else {
        var ipaddress => request->address;
    }

}



On Wed, Apr 22, 2015 at 11:08 AM, Paulo A Ferreira <
paulo.a.ferreira at gmail.com> wrote:

> request->header('x-forwarded-for');
>
> On Wed, Apr 22, 2015 at 8:45 AM, Hugues <hugues at max4mail.com> 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.
>>
>>
>> _______________________________________________
>> dancer-users mailing list
>> dancer-users at dancer.pm
>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150422/af89a80e/attachment.html>


More information about the dancer-users mailing list