mirror of
https://github.com/mempool/mempool.git
synced 2024-11-19 18:03:00 +01:00
150 lines
3.4 KiB
Plaintext
150 lines
3.4 KiB
Plaintext
###########
|
|
# mempool #
|
|
###########
|
|
|
|
# websocket has special HTTP headers
|
|
location /api/v1/ws {
|
|
try_files /dev/null @mempool-api-v1-websocket;
|
|
}
|
|
|
|
# warm cache mining and mempool API responses
|
|
location /api/v1/statistics {
|
|
try_files /dev/null @mempool-api-v1-cache-warm;
|
|
}
|
|
location /api/v1/mining {
|
|
try_files /dev/null @mempool-api-v1-cache-warm;
|
|
}
|
|
|
|
# it's ok to cache blockchain data "forever", so we do 30d
|
|
location /api/v1/block/ {
|
|
try_files /dev/null @mempool-api-v1-cache-forever;
|
|
}
|
|
|
|
# everything else gets "normal" cache
|
|
location /api/v1 {
|
|
try_files /dev/null @mempool-api-v1-cache-normal;
|
|
}
|
|
|
|
###########
|
|
# esplora #
|
|
###########
|
|
|
|
# it's ok to cache blockchain data "forever", so we do 30d
|
|
location /api/block/ {
|
|
rewrite ^/api/(.*) /$1 break;
|
|
try_files /dev/null @esplora-api-cache-forever;
|
|
}
|
|
# other API responses cannot be cached
|
|
location /api/ {
|
|
rewrite ^/api/(.*) /$1 break;
|
|
try_files /dev/null @esplora-api-cache-disabled;
|
|
}
|
|
|
|
###########
|
|
# routing #
|
|
###########
|
|
|
|
location @mempool-api-v1-websocket {
|
|
proxy_pass $mempoolMainnet;
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Host $http_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-api-v1-cache-forever {
|
|
proxy_pass $mempoolMainnet;
|
|
|
|
proxy_set_header Host $http_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 api;
|
|
proxy_cache_valid 200 30d;
|
|
proxy_redirect off;
|
|
|
|
expires 30d;
|
|
}
|
|
|
|
location @mempool-api-v1-cache-warm {
|
|
proxy_pass $mempoolMainnet;
|
|
|
|
proxy_set_header Host $http_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 api;
|
|
proxy_cache_valid 200 10s;
|
|
proxy_redirect off;
|
|
}
|
|
|
|
location @mempool-api-v1-cache-normal {
|
|
proxy_pass $mempoolMainnet;
|
|
|
|
proxy_set_header Host $http_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 api;
|
|
proxy_cache_valid 200 10s;
|
|
proxy_redirect off;
|
|
|
|
expires 10s;
|
|
}
|
|
|
|
location @mempool-api-v1-cache-disabled {
|
|
proxy_pass $mempoolMainnet;
|
|
|
|
proxy_set_header Host $http_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-api-cache-disabled {
|
|
proxy_pass $esploraMainnet;
|
|
|
|
proxy_set_header Host $http_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-api-cache-forever {
|
|
proxy_pass $esploraMainnet;
|
|
|
|
proxy_set_header Host $http_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 api;
|
|
proxy_cache_valid 200 30d;
|
|
proxy_redirect off;
|
|
|
|
expires 30d;
|
|
}
|