server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name rpc.mfenx.com indexer.mfenx.com;
    client_max_body_size 1m;
    limit_req_status 429;
    limit_conn_status 429;

    location = /network-status.json {
        proxy_pass http://127.0.0.1:9194/status.json;
        proxy_http_version 1.1;
        proxy_connect_timeout 2s;
        proxy_read_timeout 8s;
    }

    location = /healthz {
        proxy_pass http://127.0.0.1:8545/healthz;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_connect_timeout 2s;
        proxy_read_timeout 5s;
    }

    location / {
        limit_req zone=mfenx_rpc burst=100 nodelay;
        limit_conn mfenx_conn 25;
        proxy_pass http://127.0.0.1:8545;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_connect_timeout 3s;
        proxy_read_timeout 30s;
        proxy_send_timeout 30s;
    }
}
