mempool/production/nginx/location-testnet-api.conf
wiz ba5c2ff1ad
Some checks are pending
Backend Integration Tests with MariaDB / Backend Integration Tests - node 24.13.0 (push) Waiting to run
CI Pipeline for the Backend and Frontend / Backend (dev) - node 24.13.0 (push) Waiting to run
CI Pipeline for the Backend and Frontend / Backend (prod) - node 24.13.0 (push) Waiting to run
CI Pipeline for the Backend and Frontend / Cache assets for builds (push) Waiting to run
CI Pipeline for the Backend and Frontend / Frontend (dev) - node 24.13.0 (push) Blocked by required conditions
CI Pipeline for the Backend and Frontend / Frontend (prod) - node 24.13.0 (push) Blocked by required conditions
CI Pipeline for the Backend and Frontend / E2E tests for liquid (push) Blocked by required conditions
CI Pipeline for the Backend and Frontend / E2E tests for mempool (push) Blocked by required conditions
CI Pipeline for the Backend and Frontend / E2E tests for testnet4 (push) Blocked by required conditions
CI Pipeline for the Backend and Frontend / Validate generated backend Docker JSON (push) Waiting to run
Supply Chain Audit / Backend install-script audit (push) Waiting to run
Supply Chain Audit / Frontend install-script audit (push) Waiting to run
ops: Add test networks to nginx warm cache
2026-07-14 13:02:13 +09:00

187 lines
4.5 KiB
Text

###########
# mempool #
###########
# Block the internal APIs of esplora
location /testnet/api/internal/ {
return 404;
}
location /testnet/api/v1/internal/ {
return 404;
}
# websocket has special HTTP headers
location /testnet/api/v1/ws {
rewrite ^/testnet/(.*) /$1 break;
try_files /dev/null @mempool-testnet-api-v1-websocket;
}
# warm cache mining and mempool API responses
location /testnet/api/v1/statistics {
rewrite ^/testnet/(.*) /$1 break;
try_files /dev/null @mempool-testnet-api-v1-cache-warm;
}
location /testnet/api/v1/mining {
rewrite ^/testnet/(.*) /$1 break;
try_files /dev/null @mempool-testnet-api-v1-cache-warm;
}
# it's ok to cache blockchain data "forever", so we do 30d
location /testnet/api/v1/block/ {
rewrite ^/testnet/(.*) /$1 break;
try_files /dev/null @mempool-testnet-api-v1-cache-forever;
}
# everything else gets "normal" cache
location /testnet/api/v1 {
rewrite ^/testnet/(.*) /$1 break;
try_files /dev/null @mempool-testnet-api-v1-cache-normal;
}
###########
# esplora #
###########
# route /testnet/api/fee-estimates to mempool backend instead of esplora
location = /testnet/api/fee-estimates {
rewrite ^/testnet/api/(.*) /api/v1/$1 break;
try_files /dev/null @mempool-testnet-api-v1-cache-normal;
}
# it's ok to cache blockchain data "forever", so we do 30d
location /testnet/api/block/ {
rewrite ^/testnet/api/(.*) /$1 break;
try_files /dev/null @esplora-testnet-api-cache-forever;
}
# we cache for 1s to mitigate DoS attacks
location /testnet/api/ {
rewrite ^/testnet/api/(.*) /$1 break;
try_files /dev/null @esplora-testnet-api-cache-minimal;
}
###########
# routing #
###########
location @mempool-testnet-api-v1-websocket {
proxy_pass $mempoolTestnet;
proxy_http_version 1.1;
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 Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Proto $scheme;
}
location @mempool-testnet-api-v1-cache-forever {
proxy_pass $mempoolTestnet;
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 apicold;
proxy_cache_valid 200 30d;
proxy_redirect off;
expires 30d;
}
location @mempool-testnet-api-v1-cache-warm {
proxy_pass $mempoolTestnet;
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 on;
proxy_cache_use_stale updating;
proxy_cache apiwarm;
proxy_cache_valid 200 30s;
proxy_redirect off;
expires 120s;
}
location @mempool-testnet-api-v1-cache-normal {
proxy_pass $mempoolTestnet;
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 apinormal;
proxy_cache_valid 200 10s;
proxy_redirect off;
expires 10s;
}
location @mempool-testnet-api-v1-cache-disabled {
proxy_pass $mempoolTestnet;
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_redirect off;
proxy_buffering off;
expires -1;
}
location @esplora-testnet-api-cache-disabled {
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_redirect off;
proxy_buffering off;
expires -1;
}
location @esplora-testnet-api-cache-forever {
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 apicold;
proxy_cache_valid 200 30d;
proxy_redirect off;
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;
}