2019-12-03 19:48:18 +01:00
|
|
|
# NGINX CONFIGURATION FOR FASTCGI_CACHE EXCEPTION - WordOps {{release}}
|
2019-03-04 11:39:04 +01:00
|
|
|
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
2019-03-05 20:11:05 +01:00
|
|
|
|
|
|
|
|
# do not cache xhtml request
|
2019-03-04 11:39:04 +01:00
|
|
|
map $http_x_requested_with $http_request_no_cache {
|
|
|
|
|
default 0;
|
|
|
|
|
XMLHttpRequest 1;
|
|
|
|
|
}
|
2019-03-05 20:11:05 +01:00
|
|
|
|
2023-07-23 02:26:40 +00:00
|
|
|
# do not cache requests with Authorization: header set
|
|
|
|
|
map $http_authorization $http_auth_no_cache {
|
|
|
|
|
default 1;
|
|
|
|
|
"" 0;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-05 20:11:05 +01:00
|
|
|
# do not cache requests on cookies
|
2019-03-04 11:39:04 +01:00
|
|
|
map $http_cookie $cookie_no_cache {
|
|
|
|
|
default 0;
|
|
|
|
|
"~*wordpress_[a-f0-9]+" 1;
|
|
|
|
|
"~*wp-postpass" 1;
|
|
|
|
|
"~*wordpress_logged_in" 1;
|
|
|
|
|
"~*wordpress_no_cache" 1;
|
|
|
|
|
"~*comment_author" 1;
|
|
|
|
|
"~*woocommerce_items_in_cart" 1;
|
2019-08-19 10:33:02 +08:00
|
|
|
"~*edd_items_in_cart" 1;
|
2019-03-04 11:39:04 +01:00
|
|
|
"~*woocommerce_cart_hash" 1;
|
|
|
|
|
"~*wptouch_switch_toogle" 1;
|
|
|
|
|
"~*comment_author_email_" 1;
|
2019-08-19 10:33:02 +08:00
|
|
|
"~*wptouch_switch_toggle" 1;
|
2019-04-23 19:03:42 +02:00
|
|
|
"~*edd" 1;
|
2019-03-04 11:39:04 +01:00
|
|
|
}
|
2019-03-05 20:11:05 +01:00
|
|
|
|
|
|
|
|
# do not cache the following uri
|
2019-03-04 11:39:04 +01:00
|
|
|
map $request_uri $uri_no_cache {
|
|
|
|
|
default 0;
|
2024-01-09 00:12:34 +07:00
|
|
|
"~*/wishlist/" 1;
|
2019-03-04 11:39:04 +01:00
|
|
|
"~*/wp-admin/" 1;
|
2021-04-19 15:25:28 +02:00
|
|
|
"~*/wp-[a-zA-Z0-9-]+\.php" 1;
|
2019-03-04 11:39:04 +01:00
|
|
|
"~*/feed/" 1;
|
2021-04-19 15:25:28 +02:00
|
|
|
"~*/index\.php" 1;
|
|
|
|
|
"~*/[a-z0-9_-]+-sitemap([0-9]+)?\.xml" 1;
|
|
|
|
|
"~*/sitemap(_index)?\.xml" 1;
|
|
|
|
|
"~*/wp-comments-popup\.php" 1;
|
|
|
|
|
"~*/wp-links-opml\.php" 1;
|
|
|
|
|
"~*/xmlrpc\.php" 1;
|
2021-04-19 15:36:38 +02:00
|
|
|
"~*/edd-sl/.*" 1;
|
2019-04-23 19:03:42 +02:00
|
|
|
"~*/add_to_cart/" 1;
|
|
|
|
|
"~*/cart/" 1;
|
2020-03-22 19:28:56 +08:00
|
|
|
"~*/account/" 1;
|
2019-04-23 19:03:42 +02:00
|
|
|
"~*/my-account/" 1;
|
|
|
|
|
"~*/checkout/" 1;
|
|
|
|
|
"~*/addons/" 1;
|
2021-04-19 15:36:38 +02:00
|
|
|
"~*/wc-api/.*" 1;
|
2019-04-23 19:03:42 +02:00
|
|
|
"~*/logout/" 1;
|
|
|
|
|
"~*/lost-password/" 1;
|
2019-08-14 18:42:19 +02:00
|
|
|
"~*/panier/" 1;
|
|
|
|
|
"~*/mon-compte/" 1;
|
|
|
|
|
"~*/embed" 1;
|
|
|
|
|
"~*/commande/" 1;
|
|
|
|
|
"~*/resetpass/" 1;
|
2021-07-16 23:24:06 +08:00
|
|
|
"~*/wp.serviceworker" 1;
|
2019-03-04 11:39:04 +01:00
|
|
|
}
|
2019-08-27 12:32:48 +02:00
|
|
|
# mobile_prefix needed for WP-Rocket
|
2019-08-19 18:15:07 +02:00
|
|
|
map $http_user_agent $mobile_prefix {
|
|
|
|
|
default "";
|
|
|
|
|
"~*iphone" -mobile;
|
|
|
|
|
"~*android" -mobile;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-05 20:11:05 +01:00
|
|
|
# do not cache requests with query strings
|
2020-10-25 14:19:08 +01:00
|
|
|
map $is_args $is_args_no_cache {
|
2019-03-04 11:39:04 +01:00
|
|
|
default 1;
|
|
|
|
|
"" 0;
|
|
|
|
|
}
|
2019-03-05 20:11:05 +01:00
|
|
|
|
2020-10-25 14:19:08 +01:00
|
|
|
# cache requests with query string related to analytics
|
|
|
|
|
map $args $args_to_cache {
|
|
|
|
|
default 0;
|
|
|
|
|
"~*utm_" 1;
|
|
|
|
|
"~*fbclid" 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# do not cache requests with query strings excepted analytics related queries
|
|
|
|
|
map $is_args_no_cache$args_to_cache $query_no_cache {
|
2025-10-16 01:52:03 -07:00
|
|
|
default 1;
|
2020-10-25 14:19:08 +01:00
|
|
|
00 0;
|
|
|
|
|
11 0;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-05 20:11:05 +01:00
|
|
|
# if all previous check are passed, $skip_cache = 0
|
2023-07-23 02:26:40 +00:00
|
|
|
map $http_request_no_cache$http_auth_no_cache$cookie_no_cache$uri_no_cache$query_no_cache $skip_cache {
|
2019-03-04 11:39:04 +01:00
|
|
|
default 1;
|
2023-07-23 02:26:40 +00:00
|
|
|
00000 0;
|
2019-03-04 11:39:04 +01:00
|
|
|
}
|
2019-03-05 20:11:05 +01:00
|
|
|
|
2019-08-15 19:59:23 +02:00
|
|
|
# map $skip_cache with $cache_uri for --wpsc --wpce & --wprocket stack
|
2019-03-05 20:11:05 +01:00
|
|
|
map $skip_cache $cache_uri {
|
|
|
|
|
0 $request_uri;
|
2019-04-23 19:03:42 +02:00
|
|
|
default 'null cache';
|
2019-03-05 20:11:05 +01:00
|
|
|
}
|
2019-08-05 21:48:14 +02:00
|
|
|
|
2019-08-27 12:32:48 +02:00
|
|
|
# http_prefix needed for WP-Rocket
|
2019-08-05 21:48:14 +02:00
|
|
|
map $https $https_prefix {
|
|
|
|
|
default "";
|
2019-08-06 00:31:47 +02:00
|
|
|
on "-https";
|
2019-08-05 21:48:14 +02:00
|
|
|
}
|
2019-08-27 12:32:48 +02:00
|
|
|
|
|
|
|
|
# needed to proxy web-socket connections
|
|
|
|
|
map $http_upgrade $connection_upgrade {
|
|
|
|
|
default upgrade;
|
|
|
|
|
'' close;
|
2020-03-22 19:28:56 +08:00
|
|
|
}
|