On Fri, Oct 18, 2019, at 14:31, Simone Bordet wrote:
> On Fri, Oct 18, 2019 at 11:59 AM Cosimo <
cosi...@streppone.it> wrote:
> >
> > Example: websocket sessions are proxied through nginx to my jetty
> > server running cometd. The comet session IP addresses are local proxy
> > IPs and ports, while ideally I'd like to have access to the client IP,
> > which is normally stored in a custom HTTP header like X-client-ip.
>
> This particular latter case is possible to achieve (and recommended)
> using the PROXY protocol rather than HTTP headers.
>
https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/
Will look into that, thanks.
> Adding other HTTP header for other use cases is trivial when using
> non-browser clients, and impossible when using browsers (because the
> WebSocket browser API do not allow to add HTTP headers).
More in general, I was hoping to inject arbitrary information when
the websocket is created, whether that is an HTTP header or something
else, f.ex. it could be a random request-id string or fingerprint added by
our nginx layer to the websocket upgrade request, so not necessarily
with browser interaction.
I seem to understand there's a few mechanisms to do this (WebSocketUpgradeFilter,
WebSocketCreator, WebSocketServlet? ...) but I can't see yet if and how they
would be accessible from the comet server classes.
Tried searching in the comet source distribution and tests but didn't find
anything similar.
--
Cosimo