I request some json data by some url, sometimes it works fine and sometimes doesn't ... I looked another related cuestion here, but it seems to recommend not change content-length by middleware ... my json data incomplete is as image below shows:
my app nginx config:
server {
listen 80;
server_name myapp.com;
access_log /var/log/nginx/myapp_access.log;
error_log /var/log/nginx/myapp_error.log;
location / {
client_max_body_size 400M;
proxy_read_timeout 120;
proxy_connect_timeout 120;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Client-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:8888;
}
}
gunicorn script:
#!/bin/bash
set -e
DJANGODIR=/home/ubuntu/apps/myapp
LOGFILE=/var/log/gunicorn/myapp.log
LOGDIR=$(dirname $LOGFILE)
NUM_WORKERS=3
# user/group to run as
USER=ubuntu
GROUP=ubuntu
cd /home/ubuntu/apps/myapp
source /home/ubuntu/.venv/myapp/bin/activate
export PYTHONPATH=$DJANGODIR:$PYTHONPATH
export NEW_RELIC_CONFIG_FILE=/home/ubuntu/newrelic/newrelic.ini
test -d $LOGDIR || mkdir -p $LOGDIR
exec /usr/local/bin/newrelic-admin run-program /home/ubuntu/.venv/myapp/bin/gunicorn_django -w $NUM_WORKERS \
--user=$USER --group=$GROUP --log-level=debug \
--log-file=$LOGFILE -b 127.0.0.1:8888 2>>$LOGFILE
Well ... I found a related question here, and I added
proxy_buffering off;
to config file and this solve the problem for my case.the file is as follows: