src/ngx_pagespeed.cc
// preaccess_handler should be at generic phase before try_files
preaccess_handler should be at generic phase before try_files
preaccess_handler should be at generic phase before try_files
ngx_int_t ps_preaccess_handler(ngx_http_request_t* r) {
  ngx_http_core_main_conf_t* cmcf;
  ngx_http_phase_handler_t* ph;
  ngx_uint_t i;
  cmcf = static_cast<ngx_http_core_main_conf_t*>(
      ngx_http_get_module_main_conf(r, ngx_http_core_module));
  ph = cmcf->phase_engine.handlers;
  i = r->phase_handler;
  #if (nginx_version < NGINX_1_13_4)
  while (ph[i + 1].checker != ngx_http_core_try_files_phase &&
         ph[i + 1].checker != ngx_http_core_content_phase) {
    ph[i] = ph[i + 1];
    ph[i].next--;
    i++;
  }
  #endif
  ph[i].checker = ps_phase_handler;
  ph[i].handler = NULL;
  ph[i].next = i + 1;
  r->phase_handler--;
  return NGX_DECLINED;
}
ngx_int_t ps_preaccess_handler ( ngx_http_request_t * r ) { ngx_http_core_main_conf_t * cmcf ; ngx_http_phase_handler_t * ph ; ngx_uint_t i ; cmcf = static_cast < ngx_http_core_main_conf_t * > ( ngx_http_get_module_main_conf ( r , ngx_http_core_module ) ) ; ph = cmcf -> phase_engine . handlers ; i = r -> phase_handler ; #if ( nginx_version < NGINX_1_13_4 ) while ( ph [ i + 1 ] . checker != ngx_http_core_try_files_phase && ph [ i + 1 ] . checker != ngx_http_core_content_phase ) { ph [ i ] = ph [ i + 1 ] ; ph [ i ] . next -- ; i ++ ; } #endif ph [ i ] . checker = ps_phase_handler ; ph [ i ] . handler = NULL ; ph [ i ] . next = i + 1 ; r -> phase_handler -- ; return NGX_DECLINED ; }
preaccess_handler should be at generic phase before try_files
preaccess_handler should be at generic phase before try_files
// move handlers before try_files && content phase // As of nginx 1.13.4 we will be right before the try_files module // insert ps phase handler // next preaccess handler