Hello,

We also ran into this issue with prosody 0.12. Specifically, we have a
custom module for rate limiting[0] which registers as a session filter
and uses session.ip. The code in mod_websocket replaces session.ip
with request.ip, but only after the session filters are applied. As a
result, our module runs with session.ip still set to conn:ip(), which
is the proxy's address and not what we want.

I'm attaching an updated patch for 0.12.


[0] 
https://github.com/jitsi/infra-configuration/blob/main/ansible/roles/prosody/files/mod_rate_limit.lua

On Thu, Jul 30, 2020 at 5:18 AM Boris Grozev <bo...@sip-communicator.org> wrote:
>
> Hello,
>
> Any thoughts about accepting this patch, or suggestions for other ways
> to solve the problem?
>
> Regards,
> Boris
>
> On Tue, Jun 2, 2020 at 12:51 PM Boris Grozev <bo...@sip-communicator.org> 
> wrote:
> >
> > Hello everyone,
> >
> > We ran into a problem where `session.ip` is not set when the filters
> > for a new session are initialized.
> >
> > With BOSH the session object is created in mod_bosh directly and
> > `session.ip` is set at that stage (before the initialize_fillters
> > call). With mod_websocket, however, the session is created using
> > `c2s_listener.onconnect(conn)`. This leads to the session filters
> > being initialized before session.ip is set from the HTTP headers.
> >
> > This patch piggybacks the IP address from the HTTP headers as a
> > property of 'conn', as that was the most straightforward way I found
> > of doing it. Please let me know if there's a better solution.
> >
> > Regards,
> > Boris

-- 
You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prosody-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prosody-dev/CAFCpYuwNUOyr9mNP3HJOwgiitx8w7yxOHmpGQXxJDi-3VEt0NQ%40mail.gmail.com.

Attachment: mod_websocket_session_ip-0.12.patch
Description: Binary data

Reply via email to