0

I have a client calling my web services that sit behind an nginx proxy. Their total request time can run up to 7-8 seconds but the upstream requests are sub-1sec.

I'm curious and can't find in the docs, how are delayed requests handled requests? For example, if I'm receiving headers but not the body for 5 seconds, will nginx wait until the full HTTPS request is received before dispatching the request to the upstream destination?

Here's my nginx.conf config which is pretty vanilla. This is a sanitized version:

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
  worker_connections 1024;
}

http {
  log_format apm '"$time_local" client=$remote_addr '
                 'method=$request_method request="$request" '
                 'server_name=$server_name '
                 'request_length=$request_length '
                 'status=$status bytes_sent=$bytes_sent '
                 'body_bytes_sent=$body_bytes_sent '
                 'referer=$http_referer '
                 'user_agent="$http_user_agent" '
                 'upstream_addr=$upstream_addr '
                 'upstream_status=$upstream_status '
                 'request_time=$request_time '
                 'upstream_response_time=$upstream_response_time '
                 'upstream_connect_time=$upstream_connect_time '
                 'upstream_header_time=$upstream_header_time';

  access_log  /var/log/nginx/access.log  apm;

  sendfile            on;
  tcp_nopush          on;
  tcp_nodelay         on;
  keepalive_timeout   65;
  types_hash_max_size 2048;
  server_names_hash_bucket_size 64;

  include             mime.types;
  default_type        application/octet-stream;

  server {
    listen 443 ssl;
    server_name example.com;
    ssl_certificate     ssl/cert.crt;
    ssl_certificate_key ssl/cert.key;

    include conf.d/*.conf;

    location / {
      # Reject requests with unsupported HTTP method
      if ($request_method !~ ^(GET|POST|HEAD|OPTIONS|PUT|DELETE)$) {
        return 405;
      }

      proxy_pass https://example.com;
    }
  }
}
tommy_o
  • 141
  • 4

0 Answers0