Apache , NodeJs, Server Sent Events
<p>First of all, I know (<strong>Putting Node under Apache</strong>) this is not the approach to go but due to time constraint I cannot experiment.<br>
I am trying to use Server Sent events for a mobile application. After reading all over Net, I figured out that <strong>Nodejs</strong> is the server to go for. My 80/443 port is occupied by Apache Web server, so I want Node To run behind Apache.
<br><br>The Problems which I am facing are:-<br><br>1. I am not able to get the <strong>close/end</strong> events on refreshing browser or closing browser rather I get after a fixed certain amount of delay, so not able to maintain when the client shuts down connection in Nodejs.  <br> </p>

<pre><code>req.on("close", function() {
    removeConnection(res);
    console.log('Connection closed');
});
</code></pre>

<p><br>2. Apache is sending <strong>Keep-Alive:timeout=5, max=100</strong> which I dont want as I want client to be connected forever till anyone closes connection, due to this Browser automatically closes connection and I start getting <strong>net::ERR_INCOMPLETE_CHUNKED_ENCODING</strong>. How Can I modify this value only for Node Proxy Requests.<br><br>I have added <br>ProxyPass /events <a href="http://localhost:5000/events" rel="nofollow">http://localhost:5000/events</a>
<br>ProxyPassReverse /events <a href="http://localhost:5000/events" rel="nofollow">http://localhost:5000/events</a><br><br><strong>Response Headers</strong><br><br>
Access-Control-Allow-Headers:key,origin, x-requested-with, content-   type,Accept,Content-Type<br>
Access-Control-Allow-Methods:PUT, GET, POST, DELETE, OPTIONS<br>
Access-Control-Allow-Origin:*<br>
Connection:Keep-Alive<br>
Content-Type:text/event-stream; charset=utf-8<br>
custom:header<br>
Date:Wed, 13 Jan 2016 18:12:48 GMT<br>
Keep-Alive:timeout=5, max=100<br>
Server:Apache/2.4.7 (Ubuntu)<br>
Transfer-Encoding:chunked<br>
X-Powered-By:Express<br>
<br>
<strong>Note:-</strong> All this is happening when I am using Apache to proxy to Node, else if I directly hit Node (which I cannot in prod due to blocked port) everything works fine.</p>