diff --git a/nginx/conf.d/proxy.conf b/nginx/conf.d/proxy.conf index b1fddeb..f8f709a 100644 --- a/nginx/conf.d/proxy.conf +++ b/nginx/conf.d/proxy.conf @@ -32,6 +32,7 @@ map "$local_proxies$remote_proxies" $limit_host { limit_req_zone $limit_ip zone=perip:10m rate=5r/s; limit_req_zone $limit_host zone=perhost:10m rate=20r/s; +limit_req_zone $limit_host zone=readers:10m rate=15000r/s; limit_req_status 429; # configured upstreams @@ -161,14 +162,17 @@ init_worker_by_lua_block { delay = 3 else local body = json.decode(res.body) + for key, val in pairs(body.domains) do + if key:find(".", 1, true) ~= nil then + domains:set(key, val) + end + end for key, val in pairs(body.domains) do if key:find(".", 1, true) == nil then local dkey = key .. "." .. rootDomain - if dkey ~= val:sub(2) then + if dkey ~= val:sub(2) and domains:get(dkey) == nil then domains:set(dkey, val) end - else - domains:set(key, val) end end upcache.disabled = false diff --git a/nginx/conf.d/utf8.conf b/nginx/conf.d/utf8.conf index 8a99f70..771c28c 100644 --- a/nginx/conf.d/utf8.conf +++ b/nginx/conf.d/utf8.conf @@ -1 +1,2 @@ charset utf-8; +charset_types text/xml text/plain text/vnd.wap.wml application/javascript application/rss+xml text/css; diff --git a/nginx/location.d/errors.conf b/nginx/location.d/errors.conf index 59c6dd0..a1af43a 100644 --- a/nginx/location.d/errors.conf +++ b/nginx/location.d/errors.conf @@ -1,3 +1,4 @@ +error_page 410 /.well-known/statics/410.html; error_page 500 /.well-known/statics/500.html; error_page 501 /.well-known/statics/501.html; error_page 502 /.well-known/statics/503.html; diff --git a/nginx/location.d/proxy.conf b/nginx/location.d/proxy.conf index da44ee0..52e1eba 100644 --- a/nginx/location.d/proxy.conf +++ b/nginx/location.d/proxy.conf @@ -3,7 +3,7 @@ srcache_store_max_size 10m; http2_push_preload on; -proxy_intercept_errors on; +proxy_intercept_errors off; proxy_http_version 1.1; diff --git a/nginx/server.d/proxy.conf b/nginx/server.d/proxy.conf index f32ac0c..867332b 100644 --- a/nginx/server.d/proxy.conf +++ b/nginx/server.d/proxy.conf @@ -4,7 +4,7 @@ include server.d/bypasses[.]conf; location @notget { limit_req zone=perip burst=5 nodelay; - limit_req zone=perhost burst=20; + limit_req zone=perhost burst=100; set $req_body ''; set $req_jwt ''; @@ -28,14 +28,14 @@ location @notget { location /@internal/ { internal; more_set_headers "X-Upcache-Tag: $upstream_http_x_upcache_tag"; + more_set_headers "X-Upcache-Map: $upstream_http_x_upcache_map"; more_set_headers "Cache-Control: $upstream_http_cache_control"; alias /; } location @get { # move this to access by lua below using lua limit module - limit_req zone=perip burst=20; - limit_req zone=perhost burst=100; + limit_req zone=readers burst=200 nodelay; include location.d/upcache.conf; include location.d/proxy.conf; diff --git a/nginx/server.d/statics.conf b/nginx/server.d/statics.conf index 2c0da65..6becb33 100644 --- a/nginx/server.d/statics.conf +++ b/nginx/server.d/statics.conf @@ -1,4 +1,7 @@ location /.well-known/statics/ { + more_set_headers "X-Upcache-Tag: $upstream_http_x_upcache_tag"; + more_set_headers "X-Upcache-Map: $upstream_http_x_upcache_map"; + more_set_headers "Cache-Control: $upstream_http_cache_control"; expires 12h; alias ./statics/; }