Try setting { hypntoad => { proxy => 1, listen => [...] } in the config 
file, if you are using hypnotoad, or set the MOJO_REVERSE_PROXY=1 
environment variable in other cases. Support for the environment variable 
was added in Mojolicious 5.11.

This will allow retrieving the IP address using $self->tx->remote_address

On Sunday, July 13, 2014 1:34:14 AM UTC+2, Alexander Karelas wrote:
>
> I think that contains a comma-separated list of IP addresses, whereas 
> the X-Real-IP header always contains just one address. 
>
> - Alex 
>
>
> On 07/12/2014 10:58 PM, Luc Didry wrote: 
> > On 12/07/2014 21:46, Alexander Karelas wrote: 
> >> I know there's $self->tx->remote_address, but that retrieves the 
> address 
> >> of the reverse proxy (127.0.0.1). 
> >> 
> >> Because even though I have set up a X-Real-IP header and a 
> >> X-Forwarded-For header, neither of these headers get used by 
> >> $self->tx->remote_address. 
> >> 
> >> What's the right way to retrieve the client's IP address? 
> >> 
> > In your case, that's $c->req->headers->header('X-Forwarded-For'); 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to