I have been using nginx with load balancing for request forwarding purpose, each incoming request will be forwarded to ip/domain defined in upstream, below is my configuration 😀

`worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
log_format post_logs escape=none '[$time_local] $realip_remote_addr "$request" $status '

                    '$body_bytes_sent "$http_referer" '        

                 ' \n[$request_body]';

access_log  logs/post.log  post_logs;   
upstream backend
{
    server 1.1.1.1:8080;
    server 2.2.2.2:8080;    
}   
sendfile        on;       
keepalive_timeout  65;

 server {
    listen       8005 ssl;
    listen       localhost:8005 ssl;        
    server_name  localhost;
    more_set_headers 'Server: ABC';
    
    ssl_protocols TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers "EECDH+AESGCM,EDH+AESGCM";      
    ssl_certificate /logs/ssl/ssl.crt; 
    ssl_certificate_key /logs/ssl/key.key; 
        
    client_body_buffer_size  1k;
    client_header_buffer_size 1k;
    client_max_body_size 1m; #handles request size
    large_client_header_buffers 2 1k;

        
    location /wapp/ {
    
        autoindex off;          
        limit_except POST {
           deny all;
        }           
        proxy_pass      https://backend/abc/xyz;            
        proxy_read_timeout 300;         
        proxy_pass_header Server;
        proxy_set_header          Host            $host;
        proxy_set_header          X-Real-IP       $remote_addr;
        proxy_set_header          X-Forwarded-For $proxy_add_x_forwarded_for;
        add_header  X-Frame-Options "SAMEORIGIN" always;
        more_set_headers 'Server: ABC';         
    }       
}   

}`

currently there is no other traffic on this configuration i am only sending single request, When i am directly sending traffic on 1.1.1.1:8080 or 2.2.2.2:8080 with

proxy_pass https://1.1.1.1:8080/abc/xyz;

or

proxy_pass https://2.2.2.2:8080/abc/xyz;

i am getting response within second, but when i am trying with upstream configuration, i am getting response at around 2 minutes, check postman screen shot below for same

why with upstream configuration it is taking more than enough time for single request only ? can any one help ?

    5 days later

    First: you can use the xray.openresty.com to analyze this problem if it is an online machine.

    Second: you can install openresty-debug and set the error log level to debug and check the error log to see what was going on.

    error_log logs/error.log debug;

      Write a Reply...