Skip to content

Commit 6eaee32

Browse files
authored
Nginx Updates
1 parent aa5e499 commit 6eaee32

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

config/etc/nginx/globals/dev-restrictions.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ location ~ /sitemap {
1818

1919
# Block sitemaps with .xml and .xml.gz endings such as news-sitemap.xml
2020
location ~ \.xml$ {
21-
aaccess_log off;
21+
access_log off;
2222
deny all;
2323
}
2424

config/etc/nginx/globals/map-cache.conf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ map $request_method $es_request_method {
1616
map $http_cookie $es_http_cookie {
1717
default 0;
1818

19-
# Do Not Cache: General
19+
# Do Not Cache: Cookies that indicate a user is logged in or has an active session
2020
"~*amazon_Login_" 1;
2121
"~*auth_" 1;
2222
"~*bookly" 1;
@@ -38,7 +38,6 @@ map $http_cookie $es_http_cookie {
3838
"~*nocache" 1;
3939
"~*noaffiliate_" 1;
4040
"~*PHPSESSID" 1;
41-
"~*SimpleSAML" 1;
4241
"~*store_notice" 1;
4342
"~*upsell_customer" 1;
4443
"~*wishlist_reg" 1;
@@ -60,7 +59,7 @@ map $http_cookie $es_http_cookie {
6059
map $request_uri $es_request_uri {
6160
default 0;
6261

63-
# Do Not Cache: General
62+
# Do Not Cache: Locations that indicate a user is logged in, has an active session, or are dynamic in nature
6463
"~*(.*)?sitemap(.*)?\.(?:html|x[ms]l)$" 1;
6564
"~*/admin-ajax\.php" 1;
6665
"~*/chat/" 1;
@@ -85,7 +84,7 @@ map $request_uri $es_request_uri {
8584
"~*wp\.serviceworker" 1;
8685
"~*/xmlrpc\.php" 1;
8786

88-
# Do Not Cache: WooCommerce
87+
# Do Not Cache: WooCommerce and other e-commerce related pages and query strings
8988
"~*\?add-to-cart=" 1;
9089
"~*\?wc-ajax=" 1;
9190
"~*\?wc-api=" 1;
@@ -99,13 +98,13 @@ map $request_uri $es_request_uri {
9998
#"~*/store.*" 1;
10099
"~*/wc-api" 1;
101100

102-
# Do Not Cache: Sensei
101+
# Do Not Cache: Sensei LMS related pages
103102
"~*/certificate" 1;
104103
#"~*/course/" 1;
105104
#"~*/lesson/" 1;
106105
"~*/my-courses" 1;
107106

108-
# Do Not Cache: Misc Plugins
107+
# Do Not Cache: Misc Plugins and Services
109108
"~*/edd-" 1; # Easy Digital Downloads
110109

111110
# Block: Unsafe Files
@@ -119,6 +118,7 @@ map $request_uri $es_request_uri {
119118
#"~*/wp-content/uploads/enginescript-sse-site-exports/" 2; # EngineScript Simple Site Exporter
120119
}
121120

121+
# Do Not Cache: AJAX requests that include the X-Requested-With: XMLHttpRequest header, which is commonly used by JavaScript frameworks to identify AJAX requests. This is important to ensure that dynamic content loaded via AJAX is not cached and remains up-to-date for users.
122122
map $http_x_requested_with $es_http_x_request_with {
123123
default 0;
124124
"XMLHttpRequest" 1;
@@ -164,8 +164,8 @@ map $http_x_requested_with $es_http_x_request_with {
164164
#}
165165

166166
#map $http_upgrade $connection_upgrade {
167-
# default upgrade;
168-
# '' close;
167+
# default Upgrade;
168+
# '' Keep-Alive;
169169
#}
170170

171171
# Bad query strings

config/etc/nginx/globals/response-headers.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
add_header Permissions-Policy "accelerometer=(), autoplay=(), browsing-topics=(), camera=(), encrypted-media=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=*, xr-spatial-tracking=()" always;
33
add_header X-DNS-Prefetch-Control "on" always;
44
add_header X-Robots-Tag "all" always;
5-
add_header X-UA-Compatible "IE=Edge" always;
65

76
# HTTP3
87
#add_header Alt-Svc 'h3=":443";ma=86400,h3-29=":443";ma=86400,h3-27=":443";ma=86400' always;

config/etc/nginx/globals/wp-secure.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ location /.well-known/traffic-advice {
99

1010
# Ensure wp-json data is not cached
1111
location ~ ^/wp-json/ {
12-
add_header Cache-Control "no-cache, must-revalidate, max-age=0, no-store, private" always;
1312
set $skip_cache 1;
1413
try_files $uri $uri/ /index.php?$args;
1514
}

0 commit comments

Comments
 (0)