[dev] status line processing in filter module

Manlio Perillo manlio_perillo at libero.it
Sat Oct 20 00:07:59 MSD 2007


Manlio Perillo ha scritto:
 > [...]
> 
> Well, this means that the validation must be done by the WSGI application.
> 

It seems that I have solved the problem by adding this filter:

static
ngx_int_t ngx_http_wsgi_header_filter(ngx_http_request_t *r) {
   /*
    * A custom filter to enable cache validation in mod_wsgi.
    *
    * NOTE: this header filter SHOULD be executed after the
    * not_modified header filter.
    */
   static ngx_str_t  NOT_MODIFIED = ngx_string("304 Not Modified");


   if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED) {
     r->header_only = 1;
     r->headers_out.status_line = NOT_MODIFIED;
   }

   return ngx_http_next_header_filter(r);
}



After a few tests it seems that this, finally, works well.


Regards  Manlio Perillo





More information about the nginx mailing list