Merge pull request #4158 from mempool/junderw/fix-paths

Nginx: Ignore all internal-api paths
This commit is contained in:
wiz 2023-11-12 17:40:34 +09:00 committed by GitHub
commit 6a877c2a2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 3 deletions

View File

@ -214,11 +214,11 @@ class ElectrsApi implements AbstractBitcoinApi {
}
async $getMempoolTransactions(txids: string[]): Promise<IEsploraApi.Transaction[]> {
return this.failoverRouter.$post<IEsploraApi.Transaction[]>('/mempool/txs', txids, 'json');
return this.failoverRouter.$post<IEsploraApi.Transaction[]>('/internal/mempool/txs', txids, 'json');
}
async $getAllMempoolTransactions(lastSeenTxid?: string): Promise<IEsploraApi.Transaction[]> {
return this.failoverRouter.$get<IEsploraApi.Transaction[]>('/mempool/txs' + (lastSeenTxid ? '/' + lastSeenTxid : ''));
return this.failoverRouter.$get<IEsploraApi.Transaction[]>('/internal/mempool/txs' + (lastSeenTxid ? '/' + lastSeenTxid : ''));
}
$getTransactionHex(txId: string): Promise<string> {
@ -238,7 +238,7 @@ class ElectrsApi implements AbstractBitcoinApi {
}
$getTxsForBlock(hash: string): Promise<IEsploraApi.Transaction[]> {
return this.failoverRouter.$get<IEsploraApi.Transaction[]>('/block/' + hash + '/txs');
return this.failoverRouter.$get<IEsploraApi.Transaction[]>('/internal/block/' + hash + '/txs');
}
$getBlockHash(height: number): Promise<string> {

View File

@ -2,6 +2,14 @@
# mempool #
###########
# Block the internal APIs of esplora
location /api/internal/ {
return 404;
}
location /api/v1/internal/ {
return 404;
}
# websocket has special HTTP headers
location /api/v1/ws {
try_files /dev/null @mempool-api-v1-websocket;

View File

@ -2,6 +2,14 @@
# mempool #
###########
# Block the internal APIs of esplora
location /liquid/api/internal/ {
return 404;
}
location /liquid/api/v1/internal/ {
return 404;
}
# websocket has special HTTP headers
location /liquid/api/v1/ws {
rewrite ^/liquid/(.*) /$1 break;

View File

@ -2,6 +2,14 @@
# mempool #
###########
# Block the internal APIs of esplora
location /liquidtestnet/api/internal/ {
return 404;
}
location /liquidtestnet/api/v1/internal/ {
return 404;
}
# websocket has special HTTP headers
location /liquidtestnet/api/v1/ws {
rewrite ^/liquidtestnet/(.*) /$1 break;

View File

@ -2,6 +2,14 @@
# mempool #
###########
# Block the internal APIs of esplora
location /signet/api/internal/ {
return 404;
}
location /signet/api/v1/internal/ {
return 404;
}
# websocket has special HTTP headers
location /signet/api/v1/ws {
rewrite ^/signet/(.*) /$1 break;

View File

@ -2,6 +2,14 @@
# mempool #
###########
# Block the internal APIs of esplora
location /testnet/api/internal/ {
return 404;
}
location /testnet/api/v1/internal/ {
return 404;
}
# websocket has special HTTP headers
location /testnet/api/v1/ws {
rewrite ^/testnet/(.*) /$1 break;