does not work after production build
Closed this issue · 4 comments
Hello thank you for your example, works nicely for my use case in development mode but when i build the project for production SSE stop working. Using adapter-node to build production - tried using adapter-node with the example and SSE stops working :(
Would you have any idea how to solve this?
Any error message?
Tried using adapter-node in prod mode and it works.
So the Realtime Server Time example works fine in production but with the chat example i get the following error:
POS http://192.168.100.4:3000/simple-chat?/join 403 (Forbidden)
which hinted me towards CORS issue but changing the headers to below does not work :(
return new Response(stream, {
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive'
}
});
Ah, you must set ORIGIN env value to prevent cors issue on form POST action. Refer to doc.
ORIGIN=http://192.168.100.4:3000 node build
I have also updated this repo and the readme.
excellent works like a charm. thank you :)