add_header directive is not working when r->headers_out.status == NGX_HTTP_CREATED

Dmitry Petrov dmitry.petroff at gmail.com
Tue Mar 19 10:59:22 UTC 2013


Oh, never mind. This is fixed in recent nginx version.

On Tue, Mar 19, 2013 at 2:11 PM, Dmitry Petrov <dmitry.petroff at gmail.com>wrote:

> Hello
>
> I was trying to add some custom headers via add_header directive to webdav
> response and run into the problem: if response code was 201 (file created),
> then custom headers weren't added. The reason in that big if statement in
> ngx_http_headers_filter doesn't check for NGX_HTTP_CREATED. Is it intended
> behavior that custom headers aren't added to 201 responses?
>
> If we want to add headers to any 2xx response, then why just don't change
>     if ((conf->expires == NGX_HTTP_EXPIRES_OFF && conf->headers == NULL)
>         || r != r->main
>         || (r->headers_out.status != NGX_HTTP_OK
>             && r->headers_out.status != NGX_HTTP_CREATED
>             && r->headers_out.status != NGX_HTTP_NO_CONTENT
>             && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT
>             && r->headers_out.status != NGX_HTTP_MOVED_PERMANENTLY
>             && r->headers_out.status != NGX_HTTP_MOVED_TEMPORARILY
>             && r->headers_out.status != NGX_HTTP_SEE_OTHER
>             && r->headers_out.status != NGX_HTTP_NOT_MODIFIED
>             && r->headers_out.status != NGX_HTTP_TEMPORARY_REDIRECT))
>     {
>         return ngx_http_next_header_filter(r);
>     }
> to
>     if ((conf->expires == NGX_HTTP_EXPIRES_OFF && conf->headers == NULL)
>          || r != r->main
>         || r->headers_out.status / 100 != 2)
>     {
>         return ngx_http_next_header_filter(r);
>     }
>
> --
> Regards,
> Dmitry
>



-- 
Regards,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20130319/1e949e07/attachment.html>


More information about the nginx-devel mailing list