Send_header with NGX_HTTP_INTERNAL_SERVER_ERROR code

Hello, I have created my own NGINX module, which get rest request and
return
a response.
When I send a response with status 500 (NGX_HTTP_INTERNAL_SERVER_ERROR)
or
404 (NGX_HTTP_BAD_REQUEST) I see on the memory uses that the nginx
processes
is growing up
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
8734 ortal 20 0 7761628 7.335g 1736 S 69.0 47.9
0:28.37 nginx

I am using the function ‘ngx_http_send_header’ which I saw uses
‘ngx_http_headers_filter’ which hadnle the cases of
NGX_HTTP_INTERNAL_SERVER_ERROR and NGX_HTTP_BAD_REQUEST different then
NGX_HTTP_OK for example.

What am I doing wrong? Which function should I use to send a bad
response?

Thanks

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,267651,267651#msg-267651

This is a general remark, adding stuff to handle a bad request, ea.,
will
eventually kill the performance, sending bad requests is a popular way
to
create a DOS/DDOS attack since the server(the added module) has to
process
them and do something while technically it makes no sense to do anything
at
all.

All other normal requests have plenty of ways to handle
overloading/doss-ing
without affecting other users, if you want to handle a bad request your
going to need to handle that as well, ergo leave bad requests to nginx.

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,267651,267653#msg-267653

Make sense…
Thanks

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,267651,267692#msg-267692

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs