We usually suggest to avoid putting a reverse proxy in front of a Lightstreamer Server, as it could negatively impact on performance. In particular, the reverse proxy might result as a bottleneck compared to Lightstreamer Server's scalability, or it might buffer the data, thus hiding the real network status to Lightstreamer (which employs some mechanisms to throttle the data flow accordingly).
That being said, there are still cases where a reverse proxy might be needed, and NGINX is often the first choice. Below are some tips to configure NGINX to work as smoothly as possible with Lightstreamer. Any feedback and comments are welcome.
To use NGINX as a reverse proxy in front of Lightstreamer Server, it is necessary to set
proxy_bufferingto off. See
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering
As an alternative, if you prefer to disable buffering only on the connections with the Lightstreamer origin server, you need to add a special HTTP header to the Lightstreamer responses. If not already present, add this elements to the lightstreamer_conf.xml file :Smile_Ah: SYNTAX=XML]<response_http_headers>
<add name="X-Accel-Buffering">no</add>
</response_http_headers>[/SYNTAX]Make sure that the proxy_ignore_headers parameter of the NGINX configuration file does not include X-Accel-Buffering.
Then, in both cases, you need to enable
WebSockets on nginx. See
http://nginx.org/en/docs/http/websocket.html
In any case, even if you don't need WebSockets, consider that nginx proxy by default uses HTTP protocol 1.0. It is advised to turn
proxy_http_version flag to 1.1 for best performance. See
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version
To configure nginx for
TLS/SSL offloading, normal considerations apply. There are several articles on this topic, such as
https://www.nginx.com/blog/nginx-ssl/