简体   繁体   中英

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).

I have discovered that a particular POST request we make has a long response string. 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.

I have the same API with GET and POST. 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. For more info please refer attached screenshot在此处输入图像描述

I couldn't find anything about this on the Nginx and Gunicorn site or via google searching. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM