You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed both guest and logged in user cache
Fixed POST request caching
Change default value to false in-case other scripts are present on the Nginx server to be executed after this script.
Improved content cache key so it works with other request types like POST etc
{"content-type","content-range","content-length","etag","last-modified","set-cookie",}, --headers you can use this to specify what headers you want to keep on your cache HIT/UPDATING output
355
355
},
356
356
{
357
357
".*", --regex match any site / path
358
358
"video/mp4", --content-type valid types are text/css text/javascript
{"content-type","content-range","content-length","etag","last-modified","set-cookie",}, --headers you can use this to specify what headers you want to keep on your cache HIT/UPDATING output
382
382
},
383
383
]]
384
384
}
@@ -1680,7 +1680,7 @@ useful for developers who do not want to trigger a exit status and do more thing
1680
1680
true = ngx_exit(ngx_OK) --Go to content
1681
1681
false = nothing the script will run down to the end of the file and nginx will continue normally going to the next script on the server
1682
1682
]]
1683
-
localexit_status=true--true or false
1683
+
localexit_status=false--true or false
1684
1684
1685
1685
--[[
1686
1686
End Configuration
@@ -5233,6 +5233,7 @@ local function minification(content_type_list)
5233
5233
5234
5234
localrequest_method_match=0
5235
5235
localcookie_match=0
5236
+
localguest_or_logged_in=0
5236
5237
localrequest_uri_match=0
5237
5238
ifcontent_type_list[i][7] ~="" then
5238
5239
fora=1, #content_type_list[i][7] do
@@ -5242,32 +5243,38 @@ local function minification(content_type_list)
5242
5243
end
5243
5244
end
5244
5245
ifrequest_method_match==0then
5245
-
ifcontent_type_list[i][5] ==1then
5246
-
ngx_log(ngx_LOG_TYPE, "request method not matched")
5247
-
end
5246
+
--if content_type_list[i][5] == 1 then
5247
+
--ngx_log(ngx_LOG_TYPE, "request method not matched")
client_body_in_file_only on; #nginx config to test / debug on post data being stored in file incase of large post data sizes the nginx memory buffer was not big enough i turned this on to check this works as it should.
5439
+
]]
5425
5440
ngx.req.read_body()
5426
5441
localrequest_body=ngx.req.get_body_data()
5427
5442
localrequest_body_file=""
@@ -5430,6 +5445,8 @@ local function minification(content_type_list)
5430
5445
iffilethen
5431
5446
request_body_file=file
5432
5447
end
5448
+
--client_body_in_file_only on; #nginx config to test / debug
5449
+
--ngx_log(ngx_LOG_TYPE, " request_body_file is " .. request_body_file )
5433
5450
end
5434
5451
ifrequest_body_file~="" then
5435
5452
localfh, err=io.open(request_body_file, "rb")
@@ -5442,13 +5459,17 @@ local function minification(content_type_list)
5442
5459
request_body=fh:read("*all")
5443
5460
fh:close()
5444
5461
end
5462
+
ifrequest_body==nilthen
5463
+
request_body="" --set to empty string
5464
+
end
5465
+
5445
5466
localreq_headers=ngx_req_get_headers() --get all request headers
@@ -5459,9 +5480,14 @@ local function minification(content_type_list)
5459
5480
cookie_string=cookie_string..cookies[t]
5460
5481
end
5461
5482
end
5483
+
else
5484
+
req_headers["cookie"] ="" --avoid cache poisoning by removing REQUEST header cookies to ensure user is logged out when the expected logged_in cookie is missing
5462
5485
end
5463
5486
--ngx_log(ngx_LOG_TYPE, " cookies are " .. cookie_string)
0 commit comments