node.js event streaming as a client

I have a net stream that I want to use, however I can't use it directly due to the CORS limitation and that EventSource doesn't support authentication ..

I want to use node.js to get the stream from the source (domainA) and relay it to the requester. so the flow would be: domainA --> node.js --> client I was using https.request to get the data, but the thing is that its closing the connection after the first time.

so my question is - how would I proper implement this on node.js? how do I keep the connection alive and the data coming?

I was actually able to resolve this myself. what I was trying to do is simply 'mirror' an event source due to CORS restrictions. the connection kept closing after the first request, I found out that I was actually sending the wrong headers. After sending "Accept": "text/event-stream" the connection was kept opened and the data flowing. Thanks anyway!