[ops] Add nginx placeholders for unfurlbot configuration

This commit is contained in:
wiz 2022-08-27 13:54:07 +02:00
parent 69d4ba18d5
commit bba9f2608a
No known key found for this signature in database
GPG Key ID: A394E332255A6173
4 changed files with 18 additions and 28 deletions

View File

@ -70,30 +70,6 @@ location /api/v1/translators {
proxy_hide_header content-security-policy; proxy_hide_header content-security-policy;
proxy_hide_header x-frame-options; proxy_hide_header x-frame-options;
} }
location /api/v1/enterprise/images {
proxy_pass $mempoolSpaceServices;
proxy_cache services;
proxy_cache_background_update on;
proxy_cache_use_stale updating;
proxy_cache_valid 200 10m;
expires 10m;
proxy_hide_header onion-location;
proxy_hide_header strict-transport-security;
proxy_hide_header content-security-policy;
proxy_hide_header x-frame-options;
}
location /api/v1/enterprise {
proxy_pass $mempoolSpaceServices;
proxy_cache services;
proxy_cache_background_update on;
proxy_cache_use_stale updating;
proxy_cache_valid 200 5m;
expires 5m;
proxy_hide_header onion-location;
proxy_hide_header strict-transport-security;
proxy_hide_header content-security-policy;
proxy_hide_header x-frame-options;
}
location /api/v1/assets { location /api/v1/assets {
proxy_pass $mempoolSpaceServices; proxy_pass $mempoolSpaceServices;
proxy_cache services; proxy_cache services;

View File

@ -4,7 +4,7 @@ location /testnet/api/v1/lightning {
try_files /dev/null @mempool-testnet-api-v1-lightning; try_files /dev/null @mempool-testnet-api-v1-lightning;
} }
location @mempool-testnet-api-v1-lightning { location @mempool-testnet-api-v1-lightning {
proxy_pass $mempoolSignetLightning; proxy_pass $mempoolTestnetLightning;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;

View File

@ -22,6 +22,11 @@ http {
include mempool/production/nginx/http-proxy-cache.conf; include mempool/production/nginx/http-proxy-cache.conf;
include mempool/production/nginx/http-language.conf; include mempool/production/nginx/http-language.conf;
# match preview/unfurl bot user-agents
map $http_user_agent $unfurlbot {
default 0;
}
# mempool configuration # mempool configuration
include mempool/production/nginx/upstream-mempool.conf; include mempool/production/nginx/upstream-mempool.conf;
@ -42,6 +47,7 @@ http {
# for services from mempool.space like contributors on about page # for services from mempool.space like contributors on about page
set $mempoolSpaceServices "https://mempool.space"; set $mempoolSpaceServices "https://mempool.space";
set $mempoolSpaceUnfurler "http://127.0.0.1:8001";
# for mempool daemons, see upstream-mempool.conf # for mempool daemons, see upstream-mempool.conf
set $mempoolMainnet "http://mempool-bitcoin-mainnet"; set $mempoolMainnet "http://mempool-bitcoin-mainnet";
@ -77,6 +83,7 @@ http {
# for services from mempool.space like contributors on about page # for services from mempool.space like contributors on about page
set $mempoolSpaceServices "https://mempool.space"; set $mempoolSpaceServices "https://mempool.space";
set $mempoolSpaceUnfurler "http://127.0.0.1:8001";
# for mempool daemons, see upstream-mempool.conf # for mempool daemons, see upstream-mempool.conf
set $mempoolBisq "http://mempool-bitcoin-bisq"; set $mempoolBisq "http://mempool-bitcoin-bisq";
@ -105,6 +112,7 @@ http {
# for services from mempool.space like contributors on about page # for services from mempool.space like contributors on about page
set $mempoolSpaceServices "https://mempool.space"; set $mempoolSpaceServices "https://mempool.space";
set $mempoolSpaceUnfurler "http://127.0.0.1:8001";
# for mempool daemons, see upstream-mempool.conf # for mempool daemons, see upstream-mempool.conf
set $mempoolMainnet "http://mempool-liquid-mainnet"; set $mempoolMainnet "http://mempool-liquid-mainnet";

View File

@ -72,6 +72,9 @@ location ~ ^/([a-z][a-z])$ {
expires 5m; expires 5m;
} }
location ~ ^/([a-z][a-z])/ { location ~ ^/([a-z][a-z])/ {
if ($unfurlbot) {
proxy_pass $mempoolSpaceUnfurler;
}
try_files $uri /$1/index.html /en-US/index.html =404; try_files $uri /$1/index.html /en-US/index.html =404;
expires 5m; expires 5m;
} }
@ -89,6 +92,9 @@ location ~* ^/.+\..+\.(js|css) {
# catch-all for all URLs i.e. /address/foo /tx/foo /block/000 # catch-all for all URLs i.e. /address/foo /tx/foo /block/000
# cache 5 minutes since they change frequently # cache 5 minutes since they change frequently
location / { location / {
if ($unfurlbot) {
proxy_pass $mempoolSpaceUnfurler;
}
try_files /$lang/$uri $uri /en-US/$uri /en-US/index.html =404; try_files /$lang/$uri $uri /en-US/$uri /en-US/index.html =404;
expires 5m; expires 5m;
} }