root /mempool/public_html/liquid/; index index.html; set $frameOptions "DENY"; set $contentSecurityPolicy "frame-ancestors 'none'"; if ($http_referer ~ ^https://mempool.space/) { set $frameOptions "ALLOW-FROM https://mempool.space"; set $contentSecurityPolicy "frame-ancestors https://mempool.space"; } if ($http_referer ~ ^https://mempool.ninja/) { set $frameOptions "ALLOW-FROM https://mempool.ninja"; set $contentSecurityPolicy "frame-ancestors https://mempool.ninja"; } if ($http_referer ~ ^https://wiz.biz/) { set $frameOptions "ALLOW-FROM https://wiz.biz"; set $contentSecurityPolicy "frame-ancestors https://wiz.biz"; } add_header X-Frame-Options $frameOptions; add_header Content-Security-Policy $contentSecurityPolicy; add_header Onion-Location http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion$request_uri; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; # fallback for all URLs i.e. /address/foo /tx/foo /block/000 location / { try_files /$lang/$uri /$lang/$uri/ $uri $uri/ /en-US/$uri @index-redirect; add_header Cache-Control "public, no-transform"; add_header X-Frame-Options $frameOptions; add_header Content-Security-Policy $contentSecurityPolicy; add_header Onion-Location http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion$request_uri; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; expires 10m; } location /resources { try_files /$lang/$uri /$lang/$uri/ $uri $uri/ /en-US/$uri @index-redirect; add_header Cache-Control "public, no-transform"; add_header X-Frame-Options $frameOptions; add_header Content-Security-Policy $contentSecurityPolicy; add_header Onion-Location http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion$request_uri; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; expires 1h; } location @index-redirect { add_header Vary accept-language; add_header X-Frame-Options $frameOptions; add_header Content-Security-Policy $contentSecurityPolicy; add_header Onion-Location http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion$request_uri; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; rewrite (.*) /$lang/index.html; } # location block using regex are matched in order # used to rewrite resources from // to /en-US/ location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/resources/ { rewrite ^/[a-zA-Z-]*/resources/(.*) /en-US/resources/$1; } # used for cookie override location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/ { try_files $uri $uri/ /$1/index.html =404; } # static API docs location = /api { #return 302 https://mempool.space/$request_uri; try_files $uri $uri/ /en-US/index.html =404; } location = /api/ { #return 302 https://mempool.space/$request_uri; try_files $uri $uri/ /en-US/index.html =404; } location = /liquid/api { #return 302 https://mempool.space/$request_uri; try_files $uri $uri/ /en-US/index.html =404; } location = /liquid/api/ { #return 302 https://mempool.space/$request_uri; try_files $uri $uri/ /en-US/index.html =404; } location = /testnet/api { #return 302 https://mempool.space/$request_uri; try_files $uri $uri/ /en-US/index.html =404; } location = /testnet/api/ { #return 302 https://mempool.space/$request_uri; try_files $uri $uri/ /en-US/index.html =404; } # mainnet API 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; } 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; } 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; } location /api/v1/ws { proxy_pass http://127.0.0.1:8998/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } location /api/v1 { proxy_pass http://127.0.0.1:8998/api/v1; } location /api/address { proxy_pass http://electrs-liquid/address; } location /api/tx { proxy_pass http://electrs-liquid/tx; } location /api/block { proxy_pass http://electrs-liquid/block; } location /api/ { proxy_pass http://electrs-liquid/; } # liquid API location /liquid/api/v1/ws { proxy_pass http://127.0.0.1:8998/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } location /liquid/api/v1 { proxy_pass http://127.0.0.1:8998/api/v1; } location /liquid/api/ { proxy_pass http://electrs-liquid/; } # liquidtestnet API location /liquidtestnet/api/v1/ws { proxy_pass http://127.0.0.1:8994/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } location /liquidtestnet/api/v1 { proxy_pass http://127.0.0.1:8994/api/v1; } location /liquidtestnet/api/ { proxy_pass http://electrs-liquidtestnet/; }