I am having an issue with SSE over https, let me make it clear, I have an Nginx server that listen to https, and a Rails Puma in the back, So I have this in the js( coffescript ):
initStream = () ->
rechargePayment.source = new
response.headers['Content-Type'] = 'text/event-stream'
redis = Redis.new
redis.psubscribe(['proggress.refresh', 'heartbeat']) do |on|
on.pmessage do |_pattern, event, data|
logger.info 'Stream stoped'
logger.info 'Stopping Stream Thread'
So yeah, the issue was in the nginx, I had to put these settings:
proxy_set_header Connection ''; proxy_http_version 1.1; chunked_transfer_encoding off;
and in the rails controller add this:
response.headers['X-Accel-Buffering'] = 'no'