The SSE (Server-Send Events) response on the website deployed on Netlify is incomplete

Hello, I am currently experiencing with my AI generation application deployed on Netlify platform.

I have deployed my test application on Netlify and purchased the domain from Netlify as well. However, I’ve noticed a problem when the backend returns excessively long SSE (Server-Send Events) data. In such cases, the frontend does not receive all the data.

To provide a bit more context, my website configuration involves a frontend proxy. The _redirects file is set as “/api/* https://back-end-site-from-other-domain/:splat 200”, which proxies to the backend domain for access.

The issue arises when I utilize the Netlify domain combined with the API proxy path (i.e., “https://my-site/api/…”). In these instances, the SSE data is incomplete, and the connection closes after approximately 30 seconds. Interestingly, this problem does not occur when I use the backend address directly, which leads me to suspect that there may be issues with the Netlify domain.

I would greatly appreciate any advice or solutions you could provide to resolve this problem. If you need any further information, please do not hesitate to ask.

Thank you in advance for your assistance. I look forward to your response.

Netlify doesn’t keep a connection active forever. 28-30 seconds in the network max, so connections longer than that are closed. You’d have to use Edge Functions for that: Server-Sent Events (SSE) | Edge Functions on Netlify (