简体   繁体   English

从上游读取响应 header 时,仅 POST API 给出 502 badgatway => recv() failed (104: Connection reset by peer)

[英]Only POST API giving 502 badgatway => recv() failed (104: Connection reset by peer) while reading response header from upstream

I am running Django with Gunicorn + Nginx(Kubernetes, ingress).我正在使用 Gunicorn + Nginx(Kubernetes,入口)运行 Django。

I have discovered that a particular POST request we make has a long response string.我发现我们发出的特定 POST 请求有一个很长的响应字符串。 Trying to debug, it seems that Nginx is not accepting this response string based on the length - I can pass short response strings but the same issue.尝试调试时,Nginx 似乎不接受基于长度的响应字符串 - 我可以传递短响应字符串,但同样的问题。

I have the same API with GET and POST.我有与 GET 和 POST 相同的 API。 but get API with 1000 request no issue but post API with 300 requests some of the random request API's are giving 502 bad gateway.但是获得带有 1000 个请求的 API 没有问题,但是发布带有 300 个请求的 API 一些随机请求 API 给出了 502 错误网关。 For more info please refer attached screenshot有关更多信息,请参阅随附的屏幕截图在此处输入图像描述

I couldn't find anything about this on the Nginx and Gunicorn site or via google searching.我在 Nginx 和 Gunicorn 网站上或通过谷歌搜索找不到任何关于此的信息。 Does anyone know what could be the issue?有谁知道可能是什么问题?

Try with ingress annotation to timeout changes here what i am using so far not facing any issue在这里尝试使用入口注释来超时更改我目前使用的没有遇到任何问题

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: dev
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/configuration-snippet: |
      if ($request_uri ~* \.(js|css|gif|jpe?g|png)) {
        expires 1M;
        add_header Cache-Control "public";
      }
    nginx.ingress.kubernetes.io/proxy-body-size: 50m
    nginx.ingress.kubernetes.io/proxy-read-timeout: "2000"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "2000"
    nginx.ingress.kubernetes.io/rewrite-target: /
  name: test-ingress
  namespace: default
spec:
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          serviceName: service-name
          servicePort: 80

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Nginx uwsgi (104: Connection reset by peer) 同时从上游读取响应头 - Nginx uwsgi (104: Connection reset by peer) while reading response header from upstream Django gunicorn nginx“读取响应头时由同行重置连接” - Django gunicorn nginx “connection reset by peer while reading response header” * 10上游超时(110:连接超时),同时使用uwsgi从上游读取响应头 - *10 upstream timed out (110: Connection timed out) while reading response header from upstream with uwsgi django errno 104 连接由对等方重置 - django errno 104 Connection reset by peer connectionreseterror: (errno 104) 连接被对等方重置 - connectionreseterror: (errno 104) connection reset by peer ModSecurity:输出过滤器:无法读取存储桶(rc 104):由对等方重置连接 - ModSecurity: Output filter: Failed to read bucket (rc 104): Connection reset by peer 连接中止。,Django 中的错误(104,“对等连接重置”) - Connection aborted., error(104, 'Connection reset by peer') in Django 错误:[Errno 104]由对等方重置连接-开发服务器IE 9 - error: [Errno 104] Connection reset by peer - dev server IE 9 Django S3 [Errno 104]对等重置连接 - Django S3 [Errno 104] Connection reset by peer 结构rsync:读取错误:对等连接重置(104) - Fabric rsync: read error: Connection reset by peer (104)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM