2022-07-06 14:01:18 +02:00
|
|
|
###########
|
|
|
|
# mempool #
|
|
|
|
###########
|
|
|
|
|
2023-08-27 19:28:51 +02:00
|
|
|
# Block the internal APIs of esplora
|
|
|
|
location /liquidtestnet/api/internal/ {
|
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
location /liquidtestnet/api/v1/internal/ {
|
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
|
2022-07-06 14:01:18 +02:00
|
|
|
# websocket has special HTTP headers
|
2022-01-04 07:28:17 +01:00
|
|
|
location /liquidtestnet/api/v1/ws {
|
2022-07-06 14:01:18 +02:00
|
|
|
rewrite ^/liquidtestnet/(.*) /$1 break;
|
|
|
|
try_files /dev/null @mempool-liquidtestnet-api-v1-websocket;
|
|
|
|
}
|
|
|
|
|
|
|
|
# warm cache mining and mempool API responses
|
|
|
|
location /liquidtestnet/api/v1/statistics {
|
|
|
|
rewrite ^/liquidtestnet/(.*) /$1 break;
|
|
|
|
try_files /dev/null @mempool-liquidtestnet-api-v1-cache-warm;
|
|
|
|
}
|
|
|
|
location /liquidtestnet/api/v1/mining {
|
|
|
|
rewrite ^/liquidtestnet/(.*) /$1 break;
|
|
|
|
try_files /dev/null @mempool-liquidtestnet-api-v1-cache-warm;
|
2022-01-04 07:28:17 +01:00
|
|
|
}
|
2022-07-06 14:01:18 +02:00
|
|
|
|
|
|
|
# it's ok to cache blockchain data "forever", so we do 30d
|
|
|
|
location /liquidtestnet/api/v1/block/ {
|
|
|
|
rewrite ^/liquidtestnet/(.*) /$1 break;
|
|
|
|
try_files /dev/null @mempool-liquidtestnet-api-v1-cache-forever;
|
|
|
|
}
|
|
|
|
|
|
|
|
# everything else gets "normal" cache
|
2022-01-04 07:28:17 +01:00
|
|
|
location /liquidtestnet/api/v1 {
|
2022-07-06 14:01:18 +02:00
|
|
|
rewrite ^/liquidtestnet/(.*) /$1 break;
|
|
|
|
try_files /dev/null @mempool-liquidtestnet-api-v1-cache-normal;
|
|
|
|
}
|
|
|
|
|
|
|
|
###########
|
|
|
|
# esplora #
|
|
|
|
###########
|
|
|
|
|
|
|
|
# it's ok to cache blockchain data "forever", so we do 30d
|
|
|
|
location /liquidtestnet/api/block/ {
|
|
|
|
rewrite ^/liquidtestnet/api/(.*) /$1 break;
|
|
|
|
try_files /dev/null @esplora-liquidtestnet-api-cache-forever;
|
2022-01-04 07:28:17 +01:00
|
|
|
}
|
2022-07-06 14:01:18 +02:00
|
|
|
# other API responses cannot be cached
|
2022-01-04 07:28:17 +01:00
|
|
|
location /liquidtestnet/api/ {
|
2022-07-06 14:01:18 +02:00
|
|
|
rewrite ^/liquidtestnet/api/(.*) /$1 break;
|
|
|
|
try_files /dev/null @esplora-liquidtestnet-api-cache-disabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
###########
|
|
|
|
# routing #
|
|
|
|
###########
|
|
|
|
|
|
|
|
location @mempool-liquidtestnet-api-v1-websocket {
|
|
|
|
proxy_pass $mempoolTestnet;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
2022-07-11 15:31:13 +02:00
|
|
|
proxy_set_header Host $host;
|
2022-07-06 14:01:18 +02:00
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
location @mempool-liquidtestnet-api-v1-cache-forever {
|
|
|
|
proxy_pass $mempoolTestnet;
|
|
|
|
|
2022-07-11 15:31:13 +02:00
|
|
|
proxy_set_header Host $host;
|
2022-07-06 14:01:18 +02:00
|
|
|
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;
|
|
|
|
|
2024-05-09 18:14:01 +02:00
|
|
|
proxy_cache_background_update off;
|
2024-05-09 17:44:53 +02:00
|
|
|
proxy_cache_use_stale error;
|
2024-02-06 19:53:03 +01:00
|
|
|
proxy_cache apicold;
|
2022-07-06 14:01:18 +02:00
|
|
|
proxy_cache_valid 200 30d;
|
|
|
|
proxy_redirect off;
|
|
|
|
|
|
|
|
expires 30d;
|
|
|
|
}
|
|
|
|
|
|
|
|
location @mempool-liquidtestnet-api-v1-cache-warm {
|
|
|
|
proxy_pass $mempoolTestnet;
|
|
|
|
|
2022-07-11 15:31:13 +02:00
|
|
|
proxy_set_header Host $host;
|
2022-07-06 14:01:18 +02:00
|
|
|
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;
|
|
|
|
|
2024-05-09 18:14:01 +02:00
|
|
|
proxy_cache_background_update off;
|
2024-05-09 17:44:53 +02:00
|
|
|
proxy_cache_use_stale error;
|
2024-02-06 19:53:03 +01:00
|
|
|
proxy_cache apiwarm;
|
2022-07-06 14:01:18 +02:00
|
|
|
proxy_cache_valid 200 10s;
|
|
|
|
proxy_redirect off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location @mempool-liquidtestnet-api-v1-cache-normal {
|
|
|
|
proxy_pass $mempoolTestnet;
|
|
|
|
|
2022-07-11 15:31:13 +02:00
|
|
|
proxy_set_header Host $host;
|
2022-07-06 14:01:18 +02:00
|
|
|
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;
|
|
|
|
|
2024-02-06 19:53:03 +01:00
|
|
|
proxy_cache apinormal;
|
2022-07-06 14:01:18 +02:00
|
|
|
proxy_cache_valid 200 10s;
|
|
|
|
proxy_redirect off;
|
|
|
|
|
|
|
|
expires 10s;
|
|
|
|
}
|
|
|
|
|
|
|
|
location @mempool-liquidtestnet-api-v1-cache-disabled {
|
|
|
|
proxy_pass $mempoolTestnet;
|
|
|
|
|
2022-07-11 15:31:13 +02:00
|
|
|
proxy_set_header Host $host;
|
2022-07-06 14:01:18 +02:00
|
|
|
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_redirect off;
|
|
|
|
proxy_buffering off;
|
|
|
|
|
|
|
|
expires -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
location @esplora-liquidtestnet-api-cache-disabled {
|
|
|
|
proxy_pass $esploraTestnet;
|
|
|
|
|
2022-07-11 15:31:13 +02:00
|
|
|
proxy_set_header Host $host;
|
2022-07-06 14:01:18 +02:00
|
|
|
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_redirect off;
|
|
|
|
proxy_buffering off;
|
|
|
|
|
|
|
|
expires -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
location @esplora-liquidtestnet-api-cache-forever {
|
|
|
|
proxy_pass $esploraTestnet;
|
|
|
|
|
2022-07-11 15:31:13 +02:00
|
|
|
proxy_set_header Host $host;
|
2022-07-06 14:01:18 +02:00
|
|
|
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;
|
|
|
|
|
2024-05-09 18:14:01 +02:00
|
|
|
proxy_cache_background_update off;
|
2024-05-09 17:44:53 +02:00
|
|
|
proxy_cache_use_stale error;
|
2024-02-06 19:53:03 +01:00
|
|
|
proxy_cache apicold;
|
2022-07-06 14:01:18 +02:00
|
|
|
proxy_cache_valid 200 30d;
|
|
|
|
proxy_redirect off;
|
|
|
|
|
|
|
|
expires 30d;
|
2022-01-04 07:28:17 +01:00
|
|
|
}
|