Welcome! Log In Create A New Profile

Advanced

Re: error ngx_http_send_header

May 16, 2018 04:08PM
Hi Maxim,

I am sending the response in the request handler which I registered for

in the NGX_HTTP_SERVER_REWRITE_PHASE handler. In my handler, I have the

following code to avoid responding multiple times as well. Still, I am getting

the error.

if (r->main->count > 1)
return NGX_DECLINED;


Bhasker.


Hello!

On Wed, May 16, 2018 at 10:02:02AM -0700, Dk Jack wrote:

>* Hi,
*>* I am trying to send a custom response in my module when I encounter a
*>* request for a specific location. For example, I have setup my location as
*>* follows:
*> >* server {
*>* listen 9999;
*>* location /__my_module {
*>* set_mymodule_location;
*>* log_not_found off;
*>* }
*>* }
*> >* In my location handler, I am trying to respond to a request for this
*>* location. I get the response I expect at the client. However, I am seeing
*>* the following error message logged in error.log:
*> >* 2018/05/16 00:38:07 [alert] 225#225: *158 header already sent, client:
*>* 127.0.0.1, server: , request: "GET /__my_module HTTP/1.1", host:
*>* "localhost:9999"
*> >* Can someone let me know how I can prevent this error from
showing up. Also,
*>* the return value from ngx_http_send_header is always an NGX_ERROR. Not sure
*>* why...
*
The error indicate that you are trying to sent a response header
at the point where it was already sent. You have to invistigate
why and where it happens, and fix things. Most likely you are
trying to add your code in a wrong place.

--
Maxim Douninhttp://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

error ngx_http_send_header

dnj0496 798 May 16, 2018 01:04PM

Re: error ngx_http_send_header

Ranier Vf 449 May 16, 2018 01:24PM

Re: error ngx_http_send_header

Maxim Dounin 389 May 16, 2018 03:12PM

Re: error ngx_http_send_header

dnj0496 563 May 16, 2018 04:08PM

Re: error ngx_http_send_header

tokers 475 May 16, 2018 10:30PM

Re: error ngx_http_send_header

Maxim Dounin 403 May 17, 2018 09:14AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 179
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready