ngx_mruby icon indicating copy to clipboard operation
ngx_mruby copied to clipboard

HTTP status 200 with empty body doesn't work

Open yyamano opened this issue 9 years ago • 1 comments

mruby_content_handler_code doesn't allow HTTP status 200 with empty body. nginx allow it and the HTTP spec is not clear to me. What do you think?

I get the error message as below.

2016/08/09 21:46:32 [error] 4761#0: *1 ngx_mruby ERROR ngx_mrb_send_header: status code is 200, but response body is empty.Return NGX_HTTP_INTERNAL_SERVER_ERROR, client: 127.0.0.1, server: localhost, request: "GET /foo HTTP/1.1", host: "localhost:8080"
2016/08/09 21:46:32 [info] 4761#0: *1 ngx_mruby INFO ngx_mrb_run:822: mrb_run info: rputs_chain is null and return NGX_OK, client: 127.0.0.1, server: localhost, request: "GET /foo HTTP/1.1", host: "localhost:8080"

Here is the code.

        location /foo {
          mruby_content_handler_code '
            Nginx.return 200
          ';
        }

it works fine with nginx's return.

        location /bar {
          return 200;
        }

yyamano avatar Aug 10 '16 02:08 yyamano

For now, could you send me the patch? ngx_mruby should meet the specification of nginx as possible.

matsumotory avatar Aug 11 '16 04:08 matsumotory