Skip to content

Requests Hanging

Conor McKnight edited this page Sep 20, 2025 · 1 revision

If you encounter requests hanging set this value in the script settings to false and it should fix your issue.

localized.content_type_fix = false

As an explanation to requests hanging. Here is a example / demo.

Nginx Config

location = /main { #requesting /main will cause request to hang because of proxy_max_temp_file_size
    content_by_lua '
        local res = ngx.location.capture("/sub")
        ngx.say(res.status)
        ngx.say(#res.body)
    ';
}

location = /sub {
    proxy_redirect off;
    proxy_pass_request_headers off;

    proxy_max_temp_file_size 0; #this is the root of all evil
	#proxy_max_temp_file_size 2047m; #fix is to set this
	#proxy_buffering         off; #fix is also this
    proxy_busy_buffers_size 4k;
    proxy_buffers 2 4k;

    proxy_pass http://127.0.0.1:$server_port/backend;
}

location = /backend {  # emulate a backend emitting large data
    content_by_lua '
        ngx.print(string.rep("a", 16*10024))
    ';
}

When requesting /main your request should hang and never complete because of proxy_max_temp_file_size 0;

If you set proxy_max_temp_file_size 2047m; then request /main the request should not hang. So you have options to fix it via your nginx config or just set localized.content_type_fix = false inside the script.

Clone this wiki locally