Your IP : 18.219.9.175


Current Path : /etc/nginx/bx/maps/
Upload File :
Current File : //etc/nginx/bx/maps/composite_settings.conf

#################### compisite cache keys
## /path/to/asset             => /path/to/asset
## /path/to/asset/            => /path/to/asset
## /path/to/dir/index.php     => /path/to/dir
map $uri $composite_key {
  default                         $uri;
  ~^(/|/index.php|/index.html)$   "";
  ~^(?P<non_slash>.+)/$           $non_slash;
  ~^(?P<non_index>.+)/index.php$  $non_index;
  ~^(?P<non_index>.+)/index.html$ $non_index;
}

# disable composite cache if BX_ACTION_TYPE exists
map $http_bx_action_type $not_bx_action_type {
  default "0";
  ''      "1";
}

# disable composite cache if BX_AJAX
map $http_bx_ajax $not_bx_ajax {
  default "0";
  ''      "1";
}

# disable composite cache if method != GET
map $request_method $is_get {
  default "0";
  "GET"   "1";
}

# disable compisite cache if there next query string in agrs
# ncc
map $arg_ncc $non_arg_ncc {
  default "0";
  ''      "1";
}

# bxajaxid
map $arg_bxajaxid $non_arg_bxajaxid {
  default "0";
  ''      "1";
}

# sessid
map $arg_sessid $non_arg_sessid {
  default "0";
  ''      "1";
}

# test IE
map $http_user_agent $is_modern {
  default           "1";
  "~MSIE [5-9]"     "0";
}

# add common limit by uri path
map $uri $is_good_uri {
  default                 "1";
  ~^/bitrix/              "0";
  ~^/index_controller.php "0";
}

# not found NCC
map $cookie_BITRIX_SM_NCC $non_cookie_ncc {
  default     "0";
  ""          "1";
}

# complex test
# BITRIX_SM_LOGIN, BITRIX_SM_UIDH - hold values and BITRIX_SM_CC is empty
map $cookie_BITRIX_SM_LOGIN $is_bx_sm_login {
  default     "1";
  ""          "0";
}

map $cookie_BITRIX_SM_UIDH $is_bx_sm_uidh {
  default     "1";
  ""          "0";
}

map $cookie_BITRIX_SM_CC $is_bx_sm_cc {
  default     "1";
  "Y"         "0";
}

map "${is_bx_sm_login}${is_bx_sm_uidh}${is_bx_sm_cc}" $is_storedAuth {
  default     "1";
  "111"       "0";
}

# test all global conditions
map "${not_bx_action_type}${not_bx_ajax}${is_get}${non_arg_ncc}${non_arg_bxajaxid}${non_arg_sessid}${is_modern}${is_good_uri}${non_cookie_ncc}${is_storedAuth}" $is_global_composite {
  default     "1";
  ~0          "0";
}

##
#################### /compisite cache keys

#################### general cache setting
## /path/to/dir       => /path/to/dir/index
## /path/to/dir/      => /path/to/dir/index
## /path/to/file.php  => /path/to/php
map $uri $general_key {
  default                         $uri;
  ~^(?P<non_slash>.+)/$           $non_slash;
  ~^(?P<php_path>.+).php$         $php_path;
}

# if exists cookie PHPSESSID disable
map $cookie_PHPSESSID $non_cookie_phpsessid {
  default      "0";
  ''           "1";
}

# main condition for general cache
map "${is_get}${cookie_PHPSESSID}" $is_global_cache {
  default       "1";
  ~0            "0";
}