mirror of
https://github.com/mempool/mempool.git
synced 2024-11-19 18:03:00 +01:00
163 lines
4.1 KiB
Plaintext
163 lines
4.1 KiB
Plaintext
###########
|
|
# mempool #
|
|
###########
|
|
|
|
# Block the internal APIs of esplora
|
|
location /liquidtestnet/api/internal/ {
|
|
return 404;
|
|
}
|
|
location /liquidtestnet/api/v1/internal/ {
|
|
return 404;
|
|
}
|
|
|
|
# websocket has special HTTP headers
|
|
location /liquidtestnet/api/v1/ws {
|
|
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;
|
|
}
|
|
|
|
# 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
|
|
location /liquidtestnet/api/v1 {
|
|
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;
|
|
}
|
|
# other API responses cannot be cached
|
|
location /liquidtestnet/api/ {
|
|
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;
|
|
|
|
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-liquidtestnet-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 on;
|
|
proxy_cache_use_stale updating;
|
|
proxy_cache apicold;
|
|
proxy_cache_valid 200 30d;
|
|
proxy_redirect off;
|
|
|
|
expires 30d;
|
|
}
|
|
|
|
location @mempool-liquidtestnet-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 10s;
|
|
proxy_redirect off;
|
|
}
|
|
|
|
location @mempool-liquidtestnet-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-liquidtestnet-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-liquidtestnet-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-liquidtestnet-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 on;
|
|
proxy_cache_use_stale updating;
|
|
proxy_cache apicold;
|
|
proxy_cache_valid 200 30d;
|
|
proxy_redirect off;
|
|
|
|
expires 30d;
|
|
}
|