How to stop StreamingHttpResponse in Django on Google Cloud Run?

We have integrated the GPT API in our Django application running on Google Cloud Run. When a user makes a request, we send them a response using StreamingHttpResponse from django.http, enabling real-time streaming.

However, we currently do not have a way for users to stop an ongoing StreamingHttpResponse. We are looking for a solution to terminate the stream early if needed—without using WebSockets and without relying on Redis or other services that require VPC connectors, as they are costly for us at the moment.

Is there a way to achieve this within our existing Google Cloud Run setup?

how did you get it to work?

My cloud run is buffering the response and I have tried many different things to get it to work but no success at all.

I would appreciate if you can shed some light on this.

Back to Top