Skip to content

nginx connection hangs with a NginxJavaHeaderFilter when proxy_buffering is off #209

Closed
@mengzheng

Description

@mengzheng

The nginx connection hangs until timeout for the following nginx configuration:
header_filter_type 'java';
header_filter_name 'MyHeaderFilter'
proxy_http_version 1.1;
proxy_buffering off;

Note the curl output in verbose mode shows:

Transfer-Encoding: chunked

It works fine if I remove the header filter.

It also works fine if I make any of the following changes:

  1. change proxy_buffering to on
  2. change proxy_http_version to 1.0
  3. set Content-Length in response header

Note if I change proxy_http_version to 1.0 or set Content-Length in response header, the transfer encoding is no longer trunked. I am not sure this is related to the hanging issue. Even with trunked transfer encoding, it works fine if I change proxy_buffering to on.

For testing purpose, my filter class is simply:

public class MyFilter implements NginxJavaHeaderFilter {
@OverRide
public Object[] doFilter(int status, Map<String, Object> request, Map<String, Object> responseHeaders) throws IOException {
return Constants.PHASE_DONE;
}
}

My nginx version is 1.12.2 and my nginx-closure version is 0.4.5. You should be able to reproduce the issue easily.

This is a blocking issue for me as my customers use the above configuration for streaming large amount of data. Thanks for your help!

Jason

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions