[dancer-users] Client IP addr from behind a proxy

Stefan Hornburg (Racke) racke at linuxia.de
Thu Apr 9 09:58:18 UTC 2020


On 4/7/20 4:04 PM, Mike Diehl wrote:
> Hi all,
> 
>  
> 
> Fairly new user here...
> 
>  
> 
> I've got a server that sits on our LAN behind a SonicWall firewall. Our Dancer2 application is running on port 8080 and
> is being reverse proxied by Apache.
> 
>  
> 
> Yuck, I know.
> 
>  
> 
> So, I'd like to get the actual client's IP address for logging purposes. To test that, I've got these lines in my program:
> 
>  
> 
> session->write("CLIENT_IP", request->remote_address);
> 
> session->write("FORWARD_IP", request->header('x-forwarded-for'));
> 
> session->write("REAL_IP", request->header('x-real-ip'));
> 
>  
> 
> These tests were based on a few Google searches.
> 
>  
> 
> What I find in my session is: (sanitized)
> 
>  
> 
> CLIENT_IP: 127.0.0.1
> 
> FORWARD_IP: 98.101.x.y
> 
> REAL_IP: ~
> 
>  
> 
> However, my address is 10.2.1.219. The 98.101.x.y address is our outward facing IP address on the SonicWall.
> 
>  
> 
> The Apache config resembles:
> 
>  
> 
> <Location "/Apps/">
> 
> ProxyPass "http://127.0.0.1:8080/Apps/"
> 
> </Location>
> 
>  
> 
>  
> 
> So, is what I'm wanting to do even possible in this configuration? If so, how?

Hello Mike,

did you add behind_proxy to your configuration
(https://metacpan.org/pod/Dancer2::Manual::Deployment#Running-stand-alone-behind-a-proxy-/-load-balancer) ?

Regards
          Racke

> 
>  
> 
> Thanks in advance,
> 
>  
> 
> -- 
> 
> Mike Diehl
> 
> 
> _______________________________________________
> dancer-users mailing list
> dancer-users at lists.preshweb.co.uk
> https://lists.preshweb.co.uk/mailman/listinfo/dancer-users
> 


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20200409/7ae5caac/attachment.sig>


More information about the dancer-users mailing list