Skip to content

Commit 793a344

Browse files
niktestNikita Alekseev
andauthored
Fixing the template for WordPress to avoid caching of WordPress REST API (hestiacp#3069)
* Fixing the template for WordPress to avoid caching of WordPress REST API routes * Fixing the template for common caching to avoid caching of WordPress REST API routes Co-authored-by: Nikita Alekseev <niktest@mail.ru>
1 parent 88cf9ba commit 793a344

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

install/deb/templates/web/nginx/caching.stpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ server {
2626
proxy_no_cache $no_cache;
2727

2828
set $no_cache 0;
29-
if ($request_uri ~* "/wp-admin/|wp-.*.php|xmlrpc.php|/store.*|/cart.*|/my-account.*|/checkout.*|/user/|/admin/|/administrator/|/manager/|index.php") {
29+
if ($request_uri ~* "/wp-admin/|/wp-json/|wp-.*.php|xmlrpc.php|/store.*|/cart.*|/my-account.*|/checkout.*|/user/|/admin/|/administrator/|/manager/|index.php") {
3030
set $no_cache 1;
3131
}
3232
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart|woocommerce_cart_hash|PHPSESSID") {

install/deb/templates/web/nginx/caching.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ server {
2121
proxy_no_cache $no_cache;
2222
2323
set $no_cache 0;
24-
if ($request_uri ~* "/wp-admin/|wp-.*.php|xmlrpc.php|/store.*|/cart.*|/my-account.*|/checkout.*|/user/|/admin/|/administrator/|/manager/|index.php") {
24+
if ($request_uri ~* "/wp-admin/|/wp-json/|wp-.*.php|xmlrpc.php|/store.*|/cart.*|/my-account.*|/checkout.*|/user/|/admin/|/administrator/|/manager/|index.php") {
2525
set $no_cache 1;
2626
}
2727
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart|woocommerce_cart_hash|PHPSESSID") {

install/deb/templates/web/nginx/php-fpm/wordpress.stpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ server {
5555
fastcgi_index index.php;
5656
include /etc/nginx/fastcgi_params;
5757
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
58-
if ($request_uri ~* "/wp-admin/|wp-.*.php|xmlrpc.php|index.php|/store.*|/cart.*|/my-account.*|/checkout.*") {
58+
if ($request_uri ~* "/wp-admin/|/wp-json/|wp-.*.php|xmlrpc.php|index.php|/store.*|/cart.*|/my-account.*|/checkout.*") {
5959
set $no_cache 1;
6060
}
6161
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart|woocommerce_cart_hash|PHPSESSID") {

install/deb/templates/web/nginx/php-fpm/wordpress.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ server {
5050
fastcgi_index index.php;
5151
include /etc/nginx/fastcgi_params;
5252
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
53-
if ($request_uri ~* "/wp-admin/|wp-.*.php|xmlrpc.php|index.php|/store.*|/cart.*|/my-account.*|/checkout.*") {
53+
if ($request_uri ~* "/wp-admin/|/wp-json/|wp-.*.php|xmlrpc.php|index.php|/store.*|/cart.*|/my-account.*|/checkout.*") {
5454
set $no_cache 1;
5555
}
5656
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart|woocommerce_cart_hash|PHPSESSID") {

0 commit comments

Comments
 (0)