Ticket #71: nginx-intercept_error_skip_404.patch

File nginx-intercept_error_skip_404.patch, 3.0 KB (added by www.google.com/accounts/o8/id?id=AItOawnA1VZSCGBObt9MGuZNyHKljvkW-zBDNko, 14 years ago)
  • src/http/modules/ngx_http_fastcgi_module.c

    diff -Nur nginx-1.1.11.orig/src/http/modules/ngx_http_fastcgi_module.c nginx-1.1.11/src/http/modules/ngx_http_fastcgi_module.c
    old new  
    287287      offsetof(ngx_http_fastcgi_loc_conf_t, upstream.pass_request_body),
    288288      NULL },
    289289
     290    // twu2 begin
     291    // option to skip 404 error
     292    { ngx_string("fastcgi_intercept_error_skip_404"),
     293      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
     294      ngx_conf_set_flag_slot,
     295      NGX_HTTP_LOC_CONF_OFFSET,
     296      offsetof(ngx_http_fastcgi_loc_conf_t, upstream.intercept_error_skip_404),
     297      NULL },
     298    // twu2 edn
     299
    290300    { ngx_string("fastcgi_intercept_errors"),
    291301      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
    292302      ngx_conf_set_flag_slot,
     
    20922102    conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
    20932103
    20942104    conf->upstream.intercept_errors = NGX_CONF_UNSET;
     2105    // twu2 begin
     2106    // option to skip 404 error
     2107    conf->upstream.intercept_error_skip_404 = NGX_CONF_UNSET;
     2108    // twu2 end
    20952109
    20962110    /* "fastcgi_cyclic_temp_file" is disabled */
    20972111    conf->upstream.cyclic_temp_file = 0;
     
    23322346
    23332347    ngx_conf_merge_value(conf->upstream.intercept_errors,
    23342348                              prev->upstream.intercept_errors, 0);
     2349    // twu2 begin
     2350    // option to skip 404 error
     2351    ngx_conf_merge_value(conf->upstream.intercept_errors,
     2352                              prev->upstream.intercept_errors, 0);
     2353    // twu2 end
    23352354
    23362355    ngx_conf_merge_ptr_value(conf->catch_stderr, prev->catch_stderr, NULL);
    23372356
  • src/http/ngx_http_upstream.c

    diff -Nur nginx-1.1.11.orig/src/http/ngx_http_upstream.c nginx-1.1.11/src/http/ngx_http_upstream.c
    old new  
    17421742        return NGX_DECLINED;
    17431743    }
    17441744
     1745    // twu2 begin
     1746    // don't intercept 404 error (it will be processed by upstream)
     1747    if (status == NGX_HTTP_NOT_FOUND && u->conf->intercept_error_skip_404)
     1748        return NGX_DECLINED;
     1749    // twu2 end
     1750
    17451751    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
    17461752
    17471753    if (clcf->error_pages == NULL) {
  • src/http/ngx_http_upstream.h

    diff -Nur nginx-1.1.11.orig/src/http/ngx_http_upstream.h nginx-1.1.11/src/http/ngx_http_upstream.h
    old new  
    148148
    149149    ngx_flag_t                       ignore_client_abort;
    150150    ngx_flag_t                       intercept_errors;
     151    // twu2 begin
     152    // add an option to skip intercept 404 error
     153    ngx_flag_t                       intercept_error_skip_404;
     154    // twu2 end
    151155    ngx_flag_t                       cyclic_temp_file;
    152156
    153157    ngx_path_t                      *temp_path;