我有〜5MB json字符串要发送到我的端点。我正在使用boto3.client从我的python客户端调用端点。它抛出ConnectionResetError。
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\site-packages\botocore\awsrequest.py", line 92, in _send_request
method, url, body, headers, *args, **kwargs)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\site-packages\botocore\awsrequest.py", line 119, in _send_output
self.send(msg)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\site-packages\botocore\awsrequest.py", line 203, in send
return super(AWSConnection, self).send(str)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 977, in send
self.sock.sendall(data)
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 1012, in sendall
v = self.send(byte_view[count:])
File "C:\Users\corona\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 981, in send
return self._sslobj.write(data)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
[查看痕迹,我想这是由于json字符串大小引起的。有人可以帮我解决这个问题吗?
最初,我认为问题是由于客户端的请求大小限制所致,但后来我发现这是由于端点服务映像的默认nginx.conf文件中指定的限制所致。
server {
listen 8080 deferred;
**client_max_body_size 5m;**
keepalive_timeout 5;
proxy_read_timeout 1200s;
location ~ ^/(ping|invocations) {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://gunicorn;
}
location / {
return 404 "{}";
}
}
}