From 9a47191e1039464d735871386478d124c88c2d7c Mon Sep 17 00:00:00 2001 From: wiz Date: Fri, 14 Jan 2022 20:38:10 +0900 Subject: [PATCH] Update nginx.conf for mempool.space services APIs --- nginx-mempool.conf | 6 ++ .../location-api-v1-contributors-images.conf | 11 --- .../nginx/location-api-v1-contributors.conf | 8 --- .../location-api-v1-donations-images.conf | 11 --- .../nginx/location-api-v1-donations.conf | 8 --- .../nginx/location-api-v1-services.conf | 72 +++++++++++++++++++ production/nginx/nginx.conf | 21 ++++++ production/nginx/server-bisq.conf | 5 +- production/nginx/server-liquid.conf | 5 +- production/nginx/server-mempool.conf | 5 +- 10 files changed, 102 insertions(+), 50 deletions(-) delete mode 100644 production/nginx/location-api-v1-contributors-images.conf delete mode 100644 production/nginx/location-api-v1-contributors.conf delete mode 100644 production/nginx/location-api-v1-donations-images.conf delete mode 100644 production/nginx/location-api-v1-donations.conf create mode 100644 production/nginx/location-api-v1-services.conf diff --git a/nginx-mempool.conf b/nginx-mempool.conf index 63e9a6ac5..336f4efde 100644 --- a/nginx-mempool.conf +++ b/nginx-mempool.conf @@ -57,6 +57,12 @@ location /api/v1/contributors/images { proxy_pass https://mempool.space; } + location /api/v1/translators { + proxy_pass https://mempool.space; + } + location /api/v1/translators/images { + proxy_pass https://mempool.space; + } location /api/v1/ws { proxy_pass http://127.0.0.1:8999/; proxy_http_version 1.1; diff --git a/production/nginx/location-api-v1-contributors-images.conf b/production/nginx/location-api-v1-contributors-images.conf deleted file mode 100644 index a308e3ee1..000000000 --- a/production/nginx/location-api-v1-contributors-images.conf +++ /dev/null @@ -1,11 +0,0 @@ -location /api/v1/contributors/images { - proxy_pass https://mempool.space; - proxy_cache services; - proxy_cache_valid 200 1d; - expires 7d; - add_header Cache-Control "public, no-transform"; - proxy_hide_header onion-location; - proxy_hide_header strict-transport-security; - proxy_hide_header content-security-policy; - proxy_hide_header x-frame-options; -} diff --git a/production/nginx/location-api-v1-contributors.conf b/production/nginx/location-api-v1-contributors.conf deleted file mode 100644 index 34fb5d06c..000000000 --- a/production/nginx/location-api-v1-contributors.conf +++ /dev/null @@ -1,8 +0,0 @@ -location /api/v1/contributors { - proxy_pass https://mempool.space; - proxy_hide_header onion-location; - proxy_hide_header strict-transport-security; - proxy_hide_header content-security-policy; - proxy_hide_header x-frame-options; - # don't rate limit this API prefix -} diff --git a/production/nginx/location-api-v1-donations-images.conf b/production/nginx/location-api-v1-donations-images.conf deleted file mode 100644 index bbd83738a..000000000 --- a/production/nginx/location-api-v1-donations-images.conf +++ /dev/null @@ -1,11 +0,0 @@ -location /api/v1/donations/images { - proxy_pass https://mempool.space; - proxy_cache services; - proxy_cache_valid 200 1d; - expires 7d; - add_header Cache-Control "public, no-transform"; - proxy_hide_header onion-location; - proxy_hide_header strict-transport-security; - proxy_hide_header content-security-policy; - proxy_hide_header x-frame-options; -} diff --git a/production/nginx/location-api-v1-donations.conf b/production/nginx/location-api-v1-donations.conf deleted file mode 100644 index 8c748beea..000000000 --- a/production/nginx/location-api-v1-donations.conf +++ /dev/null @@ -1,8 +0,0 @@ -location /api/v1/donations { - proxy_pass https://mempool.space; - proxy_hide_header onion-location; - proxy_hide_header strict-transport-security; - proxy_hide_header content-security-policy; - proxy_hide_header x-frame-options; - # don't rate limit this API prefix -} diff --git a/production/nginx/location-api-v1-services.conf b/production/nginx/location-api-v1-services.conf new file mode 100644 index 000000000..7079dd4ac --- /dev/null +++ b/production/nginx/location-api-v1-services.conf @@ -0,0 +1,72 @@ +location /api/v1/contributors/images { + proxy_pass $mempoolSpaceServices; + proxy_cache services; + proxy_cache_background_update on; + proxy_cache_use_stale updating; + proxy_cache_valid 200 1w; + expires 1w; + 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/contributors { + proxy_pass $mempoolSpaceServices; + proxy_cache services; + proxy_cache_background_update on; + proxy_cache_use_stale updating; + proxy_cache_valid 200 1d; + expires 1d; + 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/donations/images { + proxy_pass $mempoolSpaceServices; + proxy_cache services; + proxy_cache_background_update on; + proxy_cache_use_stale updating; + proxy_cache_valid 200 1w; + expires 1w; + 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/donations { + proxy_pass $mempoolSpaceServices; + proxy_cache services; + proxy_cache_background_update on; + proxy_cache_use_stale updating; + proxy_cache_valid 200 1d; + expires 1d; + 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/translators/images { + proxy_pass $mempoolSpaceServices; + proxy_cache services; + proxy_cache_background_update on; + proxy_cache_use_stale updating; + proxy_cache_valid 200 1w; + expires 1w; + 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/translators { + proxy_pass $mempoolSpaceServices; + proxy_cache services; + proxy_cache_background_update on; + proxy_cache_use_stale updating; + proxy_cache_valid 200 1d; + expires 1d; + proxy_hide_header onion-location; + proxy_hide_header strict-transport-security; + proxy_hide_header content-security-policy; + proxy_hide_header x-frame-options; +} diff --git a/production/nginx/nginx.conf b/production/nginx/nginx.conf index b7291827c..ed0d35e52 100644 --- a/production/nginx/nginx.conf +++ b/production/nginx/nginx.conf @@ -32,7 +32,14 @@ http { listen 443 ssl http2; listen [::]:443 ssl http2; server_name mempool.ninja; + + # for services from mempool.space like contributors on about page + set $mempoolSpaceServices "https://mempool.space"; + + # for mempool/backend daemon, see upstream-mempool.conf set $mempoolBackend "http://mempool-bitcoin-mainnet"; + + # for blockstream/electrs daemon, see upstream-electrs.conf set $electrsBackend "http://electrs-bitcoin-mainnet"; # tor v3 @@ -59,7 +66,14 @@ http { listen 443 ssl http2; listen [::]:443 ssl http2; server_name bisq.ninja; + + # for services from mempool.space like contributors on about page + set $mempoolSpaceServices "https://mempool.space"; + + # for mempool/backend daemon, see upstream-mempool.conf set $mempoolBackend "http://mempool-bisq-mainnet"; + + # for blockstream/electrs daemon, see upstream-electrs.conf set $electrsBackend "http://electrs-bitcoin-mainnet"; # tor v3 @@ -86,7 +100,14 @@ http { listen 443 ssl http2; listen [::]:443 ssl http2; server_name liquid.place; + + # for services from mempool.space like contributors on about page + set $mempoolSpaceServices "https://mempool.space"; + + # for mempool/backend daemon, see upstream-mempool.conf set $mempoolBackend "http://mempool-liquid-mainnet"; + + # for blockstream/electrs daemon, see upstream-electrs.conf set $electrsBackend "http://electrs-liquid-mainnet"; # tor v3 diff --git a/production/nginx/server-bisq.conf b/production/nginx/server-bisq.conf index 999ea1725..3933b6e4d 100644 --- a/production/nginx/server-bisq.conf +++ b/production/nginx/server-bisq.conf @@ -1,8 +1,5 @@ include mempool/production/nginx/server-common.conf; -include mempool/production/nginx/location-api-v1-contributors.conf; -include mempool/production/nginx/location-api-v1-contributors-images.conf; -include mempool/production/nginx/location-api-v1-donations.conf; -include mempool/production/nginx/location-api-v1-donations-images.conf; +include mempool/production/nginx/location-api-v1-services.conf; proxy_cache markets; proxy_cache_valid 200 30s; diff --git a/production/nginx/server-liquid.conf b/production/nginx/server-liquid.conf index 8408dddb9..b0ed7e715 100644 --- a/production/nginx/server-liquid.conf +++ b/production/nginx/server-liquid.conf @@ -1,8 +1,5 @@ include mempool/production/nginx/server-common.conf; -include mempool/production/nginx/location-api-v1-contributors.conf; -include mempool/production/nginx/location-api-v1-contributors-images.conf; -include mempool/production/nginx/location-api-v1-donations.conf; -include mempool/production/nginx/location-api-v1-donations-images.conf; +include mempool/production/nginx/location-api-v1-services.conf; include mempool/production/nginx/location-api.conf; include mempool/production/nginx/location-liquid-api.conf; include mempool/production/nginx/location-liquidtestnet-api.conf; diff --git a/production/nginx/server-mempool.conf b/production/nginx/server-mempool.conf index 276c233f3..5a84cce17 100644 --- a/production/nginx/server-mempool.conf +++ b/production/nginx/server-mempool.conf @@ -1,9 +1,6 @@ include mempool/production/nginx/server-common.conf; include mempool/production/nginx/location-redirects.conf; -include mempool/production/nginx/location-api-v1-contributors.conf; -include mempool/production/nginx/location-api-v1-contributors-images.conf; -include mempool/production/nginx/location-api-v1-donations.conf; -include mempool/production/nginx/location-api-v1-donations-images.conf; +include mempool/production/nginx/location-api-v1-services.conf; include mempool/production/nginx/location-api.conf; include mempool/production/nginx/location-testnet-api.conf; include mempool/production/nginx/location-signet-api.conf;