[dancer-users] ip addess

Alex Mestiashvili alex at biotec.tu-dresden.de
Thu Apr 23 08:45:13 BST 2015


On 04/23/2015 09:36 AM, Stefan Hornburg (Racke) wrote:
> On 04/23/2015 09:34 AM, Hugues wrote:
>> yes but request->headers->{'x-forwarded-for'} can be
>>
>> address client, adresse proxy1, adresse proxy2 etc...
>> |
>> x-forwarded-for":"65.28.225.84, 54.240.144.193"
>>
> That's why it is better to use the Plack middleware :-).
>
> Regards
> 	Racke
>

Alternatively one can use mod_rpaf [0] for apache to set the necessary 
headers.
This code works for me together with mod_rpaf:

my $ip  = request->forwarded_for_address || request->remote_address;

Regards,
Alex

[0] https://github.com/gnif/mod_rpaf



More information about the dancer-users mailing list