ops: Implement ACL for internal APIs
This commit is contained in:
parent
43fde86e9d
commit
e918e1fdab
6
production/nginx/http-acl.conf
Normal file
6
production/nginx/http-acl.conf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# used for "internal" API restriction
|
||||||
|
geo $remote_addr $mempool_external {
|
||||||
|
127.0.0.1 '';
|
||||||
|
::1 '';
|
||||||
|
default 1;
|
||||||
|
}
|
@ -4,10 +4,17 @@
|
|||||||
|
|
||||||
# Block the internal APIs of esplora
|
# Block the internal APIs of esplora
|
||||||
location /api/internal/ {
|
location /api/internal/ {
|
||||||
|
if ($mempool_external) {
|
||||||
return 403;
|
return 403;
|
||||||
|
}
|
||||||
|
rewrite ^/api/(.*) /$1 break;
|
||||||
|
try_files /dev/null @esplora-api-cache-disabled;
|
||||||
}
|
}
|
||||||
location /api/v1/internal/ {
|
location /api/v1/internal/ {
|
||||||
|
if ($mempool_external) {
|
||||||
return 403;
|
return 403;
|
||||||
|
}
|
||||||
|
try_files /dev/null @mempool-api-v1-cache-normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
# websocket has special HTTP headers
|
# websocket has special HTTP headers
|
||||||
|
@ -19,6 +19,7 @@ http {
|
|||||||
|
|
||||||
# HTTP basic configuration
|
# HTTP basic configuration
|
||||||
include mempool/production/nginx/http-basic.conf;
|
include mempool/production/nginx/http-basic.conf;
|
||||||
|
include mempool/production/nginx/http-acl.conf;
|
||||||
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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user