avalanche123 / cassandra-web

A web interface for Apache Cassandra
http://avalanche123.com/cassandra-web/
MIT License
137 stars 52 forks source link

Support for ingress-controller/load balancer #31

Open acolombier opened 4 years ago

acolombier commented 4 years ago

This is more of a feature request, as the issue only occurs with a specific setup (cassandra-web behind an ingress controller or a load balancer). This seems to be related to #27

Expected behavior

Can use cassandra-web when it sits behind any kind of proxy-like setup

Actual behavior

The home page doesn't initialize and remain empty. Furthermore, a JS exceptions shows up in the console.

Context

It appears that this limitation is related to the way Cassandra events are propagated to the front-end: The /events endpoint seems to be a blocking requests, which provides vital data in the header. The front-end loads them, by leveraging the XMLHttpRequest.readyState.HEADERS_RECEIVED and then hangs on the request, till it eventually receives event or timeout.

Fix proposal

A way to fix this issue would be to replace this endpoint with a web socket, which are widely supported by proxy-like mechanisms. After making some researches, it seems there is a package called sinatra-websocket which allow to create web-socket in a Sinatra API.

I would definitely offer my help on that one, as it seems very easy to implement, unfortunately, I have never done any Ruby, and while the syntax is very easy, I have no clue on how to provide correct testing for such a change. However, I would be very happy to help on the front-end update.