ops: Cache testnet electrs endpoints for minimum of 1s
This commit is contained in:
parent
0a9703f164
commit
e75f913af3
@ -47,10 +47,10 @@ location /testnet/api/block/ {
|
|||||||
rewrite ^/testnet/api/(.*) /$1 break;
|
rewrite ^/testnet/api/(.*) /$1 break;
|
||||||
try_files /dev/null @esplora-testnet-api-cache-forever;
|
try_files /dev/null @esplora-testnet-api-cache-forever;
|
||||||
}
|
}
|
||||||
# other API responses cannot be cached
|
# we cache for 1s to mitigate DoS attacks
|
||||||
location /testnet/api/ {
|
location /testnet/api/ {
|
||||||
rewrite ^/testnet/api/(.*) /$1 break;
|
rewrite ^/testnet/api/(.*) /$1 break;
|
||||||
try_files /dev/null @esplora-testnet-api-cache-disabled;
|
try_files /dev/null @esplora-testnet-api-cache-minimal;
|
||||||
}
|
}
|
||||||
|
|
||||||
###########
|
###########
|
||||||
@ -160,3 +160,20 @@ location @esplora-testnet-api-cache-forever {
|
|||||||
|
|
||||||
expires 30d;
|
expires 30d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location @esplora-testnet-api-cache-minimal {
|
||||||
|
proxy_pass $esploraTestnet;
|
||||||
|
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
proxy_cache_background_update off;
|
||||||
|
proxy_cache_use_stale error;
|
||||||
|
proxy_cache apihot;
|
||||||
|
proxy_cache_valid 200 1s;
|
||||||
|
proxy_redirect off;
|
||||||
|
|
||||||
|
expires 1s;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user