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
_______________________________________________
nginx-devel mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to