Welcome! Log In Create A New Profile

Advanced

Re: ngx_http_send_special_response

Maxim Dounin
April 16, 2012 11:58AM
Hello!

On Mon, Apr 16, 2012 at 08:14:25AM -0700, hagai avrahami wrote:

> Hi
> Thanks
>
> The redirect response is from content handler context.
>
> Using the code you added
>
> cause Nginx to send back the Error Page (302) with
> Content-Length and Content-Type ("test/html") (And I am trying
> avoid that) without Body

Ah, sorry, I missed you want to send 302 with an empty body, not
just 302. Then instead of

return NGX_HTTP_MOVED_TEMPORARY;

you have to send actual response youself, like this:

r->headers_out.status = NGX_HTTP_MOVED_TEMPORARY;
r->headers_out.content_length_n = 0;

rc = ngx_http_send_header(r);

if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
return rc;
}

return ngx_http_send_special(r, NGX_HTTP_LAST);

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

ngx_http_send_special_response

hagai avrahami April 16, 2012 04:54AM

Re: ngx_http_send_special_response

Maxim Dounin April 16, 2012 06:38AM

Re: ngx_http_send_special_response

hagai avrahami April 16, 2012 07:30AM

Re: ngx_http_send_special_response

Maxim Dounin April 16, 2012 09:40AM

Re: ngx_http_send_special_response

hagai avrahami April 16, 2012 11:16AM

Re: ngx_http_send_special_response

Maxim Dounin April 16, 2012 11:58AM

Re: ngx_http_send_special_response

hagai avrahami April 16, 2012 12:30PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 255
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