Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
AWS ALB Random 504 Gateway Timeouts

Here's my setup:

ALB (listening on port 443)->NGINX (listening on port 444, as something else is using 443 on an EC2 proxy_pass by $host)

My issue is I'll only pull HTML every other time I use it through the ALB. I know it's not my Nginx config because If I do

curl --location -vvv -k 'https://$EC2_IP:444' -H 'Host: $FORWARD_HOST.LOCAL'

I pull HTML every time, even if I do a for loop and really spam it. Any ideas to resolve, or has anyone else ran into this problem before?

Update: After a bit more digging it looks like request_processing_time may be the culprit:

This value is set to -1 if the load balancer can't dispatch the request to a target. This can happen if the target closes the connection before the idle timeout or if the client sends a malformed request.

Will report back after modifying my nginx.conf. I've adjusted everything I can think of nothing works :/

nginx.conf
user nginx;

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

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

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

    resolver 127.0.0.1;
    resolver_timeout 60s;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   62s;
    types_hash_max_size 2048;

    # include             /etc/nginx/mime.types;
    # default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    # Settings for a TLS enabled server.

    server {
        listen       444 ssl default_server;
        listen       [::]:444 ssl default_server;
        server_name  _;

        ssl_password_file /etc/nginx/my_certs/password_file;
        ssl_certificate /etc/nginx/my_certs/my.pem;
        ssl_certificate_key /etc/nginx/my_certs/my.key;
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  1m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location ^~ /proxycheck {
            return 200 'available';
            add_header Content-Type text/plain;
        }

        location / {
            set $upstream_endpoint https://$http_host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   Host      $http_host;
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass $upstream_endpoint;
        }

    }

}

/etc/nginx/conf.d/timeout.conf

proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!