GPT 3.5 chat application not displaying generated text in real-time when accessed through Cloudflare domain

I have created a chat application that utilizes the OpenAI API to generate responses. When I run the chat application locally, it works perfectly fine.

However, when I hosted the application on an Ubuntu server and made it accessible through a Cloudflare domain, there is a delay in the real-time display of the generated text. The text only appears at the end of the answer instead of displaying gradually as it is generated.

On a side note, I’m using Cloudflare Zero Trust Tunnel to expose my internal application, without using any webservers like nginx or Apache.

I suspect that the issue may be related to Cloudflare caching mechanisms, however, I’m not sure how to go about addressing this issue.

Any help on this matter would be greatly appreciated. Thank you.