diff --git a/production/nginx/location-api-v1-services.conf b/production/nginx/location-api-v1-services.conf index 869036c54..aae49727e 100644 --- a/production/nginx/location-api-v1-services.conf +++ b/production/nginx/location-api-v1-services.conf @@ -70,30 +70,6 @@ location /api/v1/translators { proxy_hide_header content-security-policy; 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 { proxy_pass $mempoolSpaceServices; proxy_cache services; diff --git a/production/nginx/location-testnet-api-v1-lightning.conf b/production/nginx/location-testnet-api-v1-lightning.conf index 5319004ee..cc7c617a6 100644 --- a/production/nginx/location-testnet-api-v1-lightning.conf +++ b/production/nginx/location-testnet-api-v1-lightning.conf @@ -4,7 +4,7 @@ location /testnet/api/v1/lightning { try_files /dev/null @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 X-Real-IP $remote_addr; diff --git a/production/nginx/nginx.conf b/production/nginx/nginx.conf index 83a794e51..5861067e8 100644 --- a/production/nginx/nginx.conf +++ b/production/nginx/nginx.conf @@ -22,6 +22,11 @@ http { include mempool/production/nginx/http-proxy-cache.conf; include mempool/production/nginx/http-language.conf; + # match preview/unfurl bot user-agents + map $http_user_agent $unfurlbot { + default 0; + } + # mempool configuration include mempool/production/nginx/upstream-mempool.conf; @@ -42,6 +47,7 @@ http { # for services from mempool.space like contributors on about page set $mempoolSpaceServices "https://mempool.space"; + set $mempoolSpaceUnfurler "http://127.0.0.1:8001"; # for mempool daemons, see upstream-mempool.conf set $mempoolMainnet "http://mempool-bitcoin-mainnet"; @@ -77,6 +83,7 @@ http { # for services from mempool.space like contributors on about page set $mempoolSpaceServices "https://mempool.space"; + set $mempoolSpaceUnfurler "http://127.0.0.1:8001"; # for mempool daemons, see upstream-mempool.conf set $mempoolBisq "http://mempool-bitcoin-bisq"; @@ -105,6 +112,7 @@ http { # for services from mempool.space like contributors on about page set $mempoolSpaceServices "https://mempool.space"; + set $mempoolSpaceUnfurler "http://127.0.0.1:8001"; # for mempool daemons, see upstream-mempool.conf set $mempoolMainnet "http://mempool-liquid-mainnet"; diff --git a/production/nginx/server-common.conf b/production/nginx/server-common.conf index f1b21c1e0..c5781692e 100644 --- a/production/nginx/server-common.conf +++ b/production/nginx/server-common.conf @@ -59,7 +59,7 @@ location = / { # cache /resources/** for 1 week since they don't change often location ~ ^/[a-z][a-z]/resources/(.*) { try_files $uri /en-US/resources/$1 =404; - expires 1w; + expires 1w; } # cache //main.f40e91d908a068a2.js forever since they never change location ~ ^/([a-z][a-z])/(.+\..+\.(js|css)) { @@ -69,11 +69,14 @@ location ~ ^/([a-z][a-z])/(.+\..+\.(js|css)) { # cache everything else for 5 minutes location ~ ^/([a-z][a-z])$ { try_files $uri /$1/index.html /en-US/index.html =404; - expires 5m; + expires 5m; } location ~ ^/([a-z][a-z])/ { + if ($unfurlbot) { + proxy_pass $mempoolSpaceUnfurler; + } try_files $uri /$1/index.html /en-US/index.html =404; - expires 5m; + expires 5m; } # cache /resources/** for 1 week since they don't change often @@ -89,6 +92,9 @@ location ~* ^/.+\..+\.(js|css) { # catch-all for all URLs i.e. /address/foo /tx/foo /block/000 # cache 5 minutes since they change frequently location / { + if ($unfurlbot) { + proxy_pass $mempoolSpaceUnfurler; + } try_files /$lang/$uri $uri /en-US/$uri /en-US/index.html =404; expires 5m; }