Our stack is Client(Browser) <-> Nginx Reverse Proxy <-> Webserver(Flask+Gunicorn) <-> Golang gRPC server
The problem is when the client makes a call to the /realtimedata
endpoint, Flask then opens the gRPC connection and starts receiving data via a server->client unidirectional stream. It then passes it back to the client. When I run this without Nginx, I get all responses. When running with Nginx, some responses get truncated. For example, if we expect:
{
"source": "serviceA",
"timestamp": 123456789,
"data": {
"1": 24.55667,
"2": -456.5656,
...
"200": 5.678
}
}
We get
{
"source": "serviceA",
"time
Then
stamp": 123456789,
"data": {
"1": 24.55667,
"2": -456.5656,
...
"200": 5.678
}
}
This would be printed in console.log. I have proxy_buffering off;
in the nginx configuration otherwise no data makes it to the browser. Not sure how to resolve this issue.
Here is a minimum, reproducible example.
UPDATE: I've ran the minimum reproducible example with Apache2 instead of Nginx and experiencing the same random truncations.
I had the similar behavior from Apache(!) breaking up a html file respone from django. It always broke at the same position without any reason. I finally found that I accidentally did install a mod_wsgi package into Apache from a Python version that did not match the version Apache was calling my app in. Maybe it helps you.